UA Bundle SDK .NET  2.2.0.255
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Groups Pages
Manage Subscription – Delete Subscription

Prerequisites

A session and a subscription with the server must be established.

Description

The following dialog shows an example dialog to delete an existing subcription. Press the button “Show Code” to display the corresponding code, and the button “Help” to show this documentation page.

The state of the current subscription is shown in the field at “Subscription State”. At pressing the button “Delete”, the subscription and all of its monitored items are deleted. The field “Subscription State” now shows the status “Deleted”. Check the box in front of “Use Asynchronous Pattern” to call “BeginDelete” instead of “Delete”.

Sample Code

The following code deletes an existing subscription and all of its monitored items.

try
{
// get the current session from the parent form.
Session session = m_parent.Session;
// nothing to do if no session.
if (session == null)
{
return;
}
// delete subscription (10s timeout).
m_subscription.Delete(new RequestSettings() { OperationTimeout = 10000 });
// up date display.
CurrentStateTB.Text = m_subscription.ConnectionStatus.ToString();
}
catch (Exception exception)
{
ExceptionDlg.Show(this.Text, exception);
}