NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to know whether sequencefile has loaded or not?

Solved!
Go to solution

Customizing user interface.

I "reload sequencefile on start". And do not use SequenceFileView. Some sequencefile spends a long time for loading. And sometimes, reference of sequencefile should be empty. Because the sequencefile has being delete, or did not open any file last time, etc.

I need feedback from TS engine. How to get it?

0 Kudos
Message 1 of 10
(4,390 Views)

I think the following excerp from the TestStand help answers your question:

 

SequenceFiles Property (Read Only)

Syntax

ApplicationMgr.SequenceFiles

Data Type

SequenceFiles

Purpose

Collection of sequence files the application opens.

Remarks

This property eliminates the need to keep an array of open sequence files. Use the ApplicationMgr.OpenSequenceFile method to add files to the collection and the ApplicationMgr.CloseSequenceFile method to remove files from the collection.

 

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 10
(4,388 Views)

I'm sorry but i mean that i need to know the exact time when loading file finished, or feedback signal when there is no file to be loaded.

0 Kudos
Message 3 of 10
(4,375 Views)

FYI,

http://digital.ni.com/public.nsf/allkb/146D372C1F807E6D862567E7004881AB?OpenDocument

 

gives a method to programmatically load a sequencefile. While I don't think there is a feedback for the loading process =(

 

I hope I can find more information later.

0 Kudos
Message 4 of 10
(4,361 Views)

 


@neoelfish wrote:

I'm sorry but i mean that i need to know the exact time when loading file finished, or feedback signal when there is no file to be loaded.


 

It's still not clear what you are trying to do. To check for if there is a file to load do you mean you just want to check if a file exists? Are you using an ApplicationMgr control? Are you explicitly loading the files or are you using the feature of the application manager where it reloads the files you last had opened? The ApplicationMgr.SequenceFiles property will give you a collection of the files that are currently loaded. If this is not sufficient please explain why and please explain what you are trying to do and why in more detail.

 

Hope this helps,

-Doug

0 Kudos
Message 5 of 10
(4,354 Views)
Customizing user interface.

I "reload sequencefile on start". And do not use SequenceFileView.


Some sequencefiles need a long time for loading. I have to wait until loading finished, to get reference of sequencefile.  I don't know the time when loading finished. So i use "while loop" to get reference of sequencefile.

the problem is "what if there is no file (being delete, etc.) to be loaded", how to know the status?

0 Kudos
Message 6 of 10
(4,346 Views)

The loading should happen synchronously with the call to ApplicationManager.Start(). Thus once that call returns the sequence files are loaded. Do you have a multithreaded UI? In a single-threaded UI this shouldn't be an issue at all, you just know that after you call Start() then the files are loaded. In a multi-threaded UI you will need to synchronize some other way internally in your UI so your other threads know when the main thread is done calling Start().

 

Hope this helps,

-Doug

0 Kudos
Message 7 of 10
(4,338 Views)
Solution
Accepted by topic author neoelfish

It's a bit more complicated than I thought if you are running a login callback on startup (which is the default. i.e. LoginOnStart property is true). In that case you need to wait until after the login callback execution completes and the Application Manager finishes processing it. In order to do so, you can handle the AfterUIMessageEvent as follows:

 

        private bool firstExecutionEnded = false;
        private void axApplicationMgr_AfterUIMessageEvent(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_AfterUIMessageEventEvent e)
        {
            if (!firstExecutionEnded && e.uiMsg.Event == UIMessageCodes.UIMsg_EndExecution)
            {
                firstExecutionEnded = true;
                // Do what you want with this.axApplicationMgr.SequenceFiles;
            }
        }

Hope this helps,

-Doug

0 Kudos
Message 8 of 10
(4,329 Views)

Hi dug9000,

I got it. Thank you very much.

0 Kudos
Message 9 of 10
(4,301 Views)

Actually the files are always loaded after the first login, regardless of whether LoginOnStart is true or false, so you would always use the code Doug provided, not just conditionally when LoginOnStart is true.

0 Kudos
Message 10 of 10
(4,208 Views)