03-26-2021 11:53 AM
Hi
I have a very small C# windows form app that I am using to send Notification messages to a Test Stand Sequence, using the Sync Manager. My starting point was
This is working fine for sending both Set and Pulse Notifications and my tiny Application closes fine.
I am now trying to send a numeric value with my Notification. I have got this working the correct value is being seen in TestStand Sequence but I my Application will not close correctly as I cannot release the PropertyObject that I use to send the value with and so the engine will not close down.
private static INotification NewChamberIntervalRef { get; set; }
private static Engine myEngine;
private PropertyObject newInterval;
private SyncManager mySyncManager;
public TestStationControl()
{
InitializeComponent();
//Creating a notifier with name *myNotification. *SyncObjects can be shared across processes
// we are NOT launching this engine is a new Application Domain as recommended, because we need
// direct access for notifier plus this is the ONLY function for this engine.
myEngine = new Engine();
newInterval = myEngine.NewPropertyObject(PropertyValueTypes.PropValType_Number, false, "", 0);
mySyncManager = myEngine.GetSyncManager("64*NewChamberInterval") as SyncManager;
bool alreadyexists = false;
NewChamberIntervalRef = mySyncManager.CreateNotification("64*NewChamberInterval", out alreadyexists);
}
private void Start_button_Click(object sender, EventArgs e)
{
//Setting the Notification
newInterval.SetValNumber("", 0,(int)intervalNum.Value);
NewChamberIntervalRef.PulseEx(null, newInterval , true, true);
}
private void TestStationControl_FormClosing(object sender, FormClosingEventArgs e)
{
// we need to release everything then close the TestStand Engine
myEngine.DotNetGarbageCollectionInterval = 100;
newInterval = null;
mySyncManager = null;
myEngine = null;
}
03-30-2021 03:19 PM
Have you seen this?
04-07-2021 02:21 PM
Hi Michal,
I missed you post sorry. Yes I have read that.
It made me change how slightly how I was going to be this in my main application, which works nicely as I have put the C# part of the notification into the C# UI Application context and that closes down correctly when the C# UI closes.
For me side tester application, I realized a unclean closure, did not really matter, it would close and exist itself about 30 seconds after the error message popup up and as it sole function was to aid in testing the TestStand sequences without the UI running, this was fine.