on 2016 Mar 23 8:34 PM
Hello everyone.
When I throw an exception inside an event, B1 disconnects the add-on. Is there any way to find out that this happened?
I did some tests and even when the addon got disconnected I still can send messages via MessageBox for example. The only difference that I saw is that B1 does not send events anymore.
I need to know when this happens because the application will still run after being disconnected, so I need to kill the task to avoid many executables running for nothing.
Thank you in advice.
Solved the problem with the following code:
Task.Factory.StartNew(() =>
{
while (true)
{
try
{
var lActiveForm = Connection.Forms.ActiveForm;
//Disconnect form is type 0
if (lActiveForm.TypeEx == "0")
{
//Item 1 is the static text which shows the description of the disconnected addon
if (((StaticText)lActiveForm.Items.Item("1").Specific).Caption.Contains("MyAddOnName"))
System.Windows.Forms.Application.Exit();
}
}
catch { }
Thread.Sleep(1000);
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leandro,
Good idea, not ideal but it should do the trick.
I have been wondering the same my self, thanks for posting this.
But, do note that many system messages come through this form type '0'.
Maybe need to check more exact wording on the static text, to make sure it is indeed the disconnect message.
Regards
Edy
User | Count |
---|---|
94 | |
9 | |
8 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.