/// <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; } }
/// <summary> /// Closes all open connections. /// </summary> protected override void Release() { if (_eventPortTypeClient != null) { _eventPortTypeClient.Close(); } if (_notificationProducerClient != null) { _notificationProducerClient.Close(); } if (_subscriptionManagerClient != null) { _subscriptionManagerClient.Close(); } if (_pullPointSubscriptionClient != null) { _pullPointSubscriptionClient.Close(); } }