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

Prerequisites

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

Description

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

At startup, the input fields in the column “Requested Parameters” are filled out with the current subscription parameters. Edit the values you would like to change, check or uncheck the box next to “Publishing Enabled” and press the button “Modify”. The new subscription parameters set by the server are now displayed in the column “Revised Parameters”. Check the box in front of “Use Asynchronous Pattern” to call “BeginModify” instead of “Modify”.

Sample Code

The following code modifies an existing subscription according to the specified parameters and displays the revised parameters in the user interface.

try
{
// get the current session from the parent form.
Session session = m_parent.Session;
// nothing to do if no session.
if (session == null)
{
return;
}
// initialize subscription.
m_subscription.PublishingInterval = (double)PublishingIntervalUD.Value;
m_subscription.MaxKeepAliveTime = (double)KeepAliveTimeUD.Value;
m_subscription.Lifetime = (double)LifeTimeUD.Value;
m_subscription.MaxNotificationsPerPublish = (uint)MaxNotificationsUD.Value;
m_subscription.Priority = (byte)PriorityUD.Value;
m_subscription.PublishingEnabled = PublishingEnabledCK.Checked;
// create subscription.
m_subscription.Modify(new RequestSettings() { OperationTimeout = 10000 });
// update controls.
CurrentPublishingIntervalTB.Text = m_subscription.CurrentPublishingInterval.ToString();
CurrentKeepAliveTimeTB.Text = m_subscription.CurrentMaxKeepAliveTime.ToString();
CurrentLifeTimeTB.Text = m_subscription.CurrentLifetime.ToString();
CurrentMaxNotificationsTB.Text = m_subscription.CurrentMaxKeepAliveTime.ToString();
CurrentPriorityTB.Text = m_subscription.CurrentPriority.ToString();
CurrentPublishingEnabledCK.Checked = m_subscription.CurrentPublishingEnabled;
}
catch (Exception exception)
{
ExceptionDlg.Show(this.Text, exception);
}