08-30-2005 02:54 PM
private
void axApplicationMgr_UIMessageEvent(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_UIMessageEventEvent e){
switch (e.uiMsg.Event){
case (UIMessageCodes) 31001: // TPS LoadaxApplicationMgr.CloseAllSequenceFiles();
axApplicationMgr.OpenSequenceFile(e.uiMsg.StringData);
break; case (UIMessageCodes) 31002: // Close All Sequence FilesaxApplicationMgr.CloseAllSequenceFiles();
break;}
}
Pretty simple.... It even works most of the time; until the TestStand Engine detects a change in the sequence file. Then the first popup happens; Select "Yes" from the TestStand Dialog the second popup occurs. Try to exit or do anything else look out there's your exception.
Thanks in advanced for your help,
Steve
09-02-2005 09:04 AM
09-06-2005 05:24 PM
09-12-2005 04:46 PM
09-13-2005 01:26 PM
Order is a follows:
1.) Configuration entry point starts execution.
2.) PostUIMessage fires and RTOI responds by calling 'CloseAllSequenceFiles'.
3.) All Sequences files close OK.
4.) A sequence file is downloaded that is different but has the same name.
5.) PostUIMessage fires and RTOI responds by calling 'OpenSequenceFile'
6.) Error message occurs.
09-15-2005 09:35 AM
Hi Steve,
Just wanted to update you on my progress. I've continued to look at this and have now added steps in my Configuration Entry point to GetSequenceFileEx from one directory and then do a Save method to my "working" directory between my two UI Messages. Everything is still working for me in the LabVIEW Operator Interface. I'm now going into my C# Operator Interface and recreate things there to see if somehow the environment change is the cause for this problem. As soon as I have this working (or not working), I'll post it up here to see if we can see what is being done differently. I'll repost before the end of the day. Thanks.
09-15-2005 10:57 AM - edited 09-15-2005 10:57 AM
Steve,
OK, so I still haven't gotten the exact same message that you did, but I am getting some different error messages (in both LabVIEW and C#). They referred to the fact that a sequence file of the same name was still in memory. This makes sense, because when we are using the TestStand API, even though we close the sequence files using the CloseSequenceFiles method, we still have access to the sequence file in the API, and we actually have to release the sequence file. I got my code to work repeatedly with this C# code:
switch(e.uiMsg.Event){
case(UIMessageCodes)(10000):Engine engReference = axApplicationMgr.GetEngine();
int count = axApplicationMgr.SequenceFiles.Count; for (int i = 0; i < count; i++){
engReference.ReleaseSequenceFileEx(axApplicationMgr.SequenceFiles[i], 0);
}
axApplicationMgr.CloseAllSequenceFiles();
break; case(UIMessageCodes)(10001):axApplicationMgr.OpenSequenceFile(e.uiMsg.StringData);
break;}
This traverses all of the sequence files loaded in memory and releases them. This allowed my code to run over and over again with no errors. Give this a try and let me know if you continue to get errors. Thanks and have a great one.
Message Edited by Adam B. on 09-15-2005 10:58 AM
09-15-2005 11:21 AM
Hi Steve,
One more little piece for you. I'm not sure exactly how you are moving the files from the network to the working directory so I've attached my process model to show you how I'm doing it that works with the code pasted above. The configuration entry point is called "Download and Open File". I have two local variables for the network directory and the working directory and I have included a message popup so that the user can specify which sequence file to download and open. There are probably better ways to determine which file to use, but the ActiveX calls being made should work for you. Let me know if you have any questions about this or the code above. Thanks and have a good one.
09-16-2005 04:45 PM
Adam:
This didn't fix anything. In order to simplify what the system is doing I've removed some steps from your "Download and Open File" configuration entry sequence and added one break point. If you change the string parameter in the "Open the working directory sequence file" step as required and follow through the steps as listed below you'll be able to recreate the problem I've been seeing.
1.) Copy a sequence file to your local directory
2.) Copy the sequence file in your local dirtectory to your network directory (Do not change the sequence file name)
3.) Open the sequence file in your network directory in the sequence editor and add a couple of statements steps to the sequence and save the sequence file (Do not change the sequence file name)
4.) Close the sequence editor and start the RTOI
5.) Copy sequence file from local directory to TestStand/bin directory
6.) Open sequence file in the TestStand/bin directory with the RTOI and start your configuration entry sequence
7.) Sequence file closes and execution pauses after hitting break point.
8.) Copy sequence file from network directory to TestStand/bin directory
9.) Resume execution which attempts to load the sequence file with the same name from the same directory and error message occurs.
If you have any questions please feel free to contact me.
Thanks,
Steve
09-19-2005 02:43 PM
@Adam B. wrote:
This makes sense, because when we are using the TestStand API, even though we close the sequence files using the CloseSequenceFiles method, we still have access to the sequence file in the API, and we actually have to release the sequence file.
This is actually incorrect. You only need to call Engine.ReleaseSequenceFileEx on Sequence Files that have been opened directly from the Engine. The TestStand UI Controls will call Engine.ReleaseSequenceFileEx on any Sequence Files on its own.
Allen P.
TestStand R&D