private void btnUnsubscribe_Click(object sender, EventArgs e) { SafeInvoke(() => { _host.Close(); Unsubscribe request = new Unsubscribe(); _subscriptionManager.Unsubscribe(request); tcSubscription.SelectedTab = tbSubscribe; StopTimer(); }); }
/// <summary> /// Unsubscribes from the subscription in the SubscriptionManagerClient /// </summary> public void Unsubscribe() { if ((SubscriptionManagerClient != null) && ((SubscriptionManagerClient.State == CommunicationState.Opened) | (SubscriptionManagerClient.State == CommunicationState.Created))) { Unsubscribe u = new Unsubscribe(); UnsubscribeResponse oUnSubResult = SubscriptionManagerClient.Unsubscribe(u); SubscriptionManagerClient.Close(); SubRenewTimer.Stop(); OnNotification(string.Format("Subscription canceled - Current Time: {0}", System.DateTime.UtcNow)); } else { OnNotification(string.Format("No subscription to cancel - Current Time: {0}", System.DateTime.UtcNow)); } }
/// <summary> /// Unsubscribes from the subscription in the SubscriptionManagerClient /// </summary> public void Unsubscribe() { if ((SubscriptionManagerClient != null) && ((SubscriptionManagerClient.State == CommunicationState.Opened) | (SubscriptionManagerClient.State == CommunicationState.Created))) { Unsubscribe u = new Unsubscribe(); UnsubscribeResponse oUnSubResult = SubscriptionManagerClient.Unsubscribe(u); SubscriptionManagerClient.Close(); SubRenewTimer.Stop(); listBox1.Items.Add(string.Format("Subscription canceled - Current Time: {0}", DateTime.UtcNow)); listBox1.SelectedIndex = listBox1.Items.Count - 1; } else { listBox1.Items.Add(string.Format("No subscription to cancel - Current Time: {0}", DateTime.UtcNow)); listBox1.SelectedIndex = listBox1.Items.Count - 1; } }