/// <summary>
        /// Issues the general failure.
        /// </summary>
        /// <param name="gseResponse">The GetStreamingEvents response.</param>
        private void IssueGeneralFailure(GetStreamingEventsResponse gseResponse)
        {
            SubscriptionErrorEventArgs eventArgs = new SubscriptionErrorEventArgs(
                null,
                new ServiceResponseException(gseResponse));

            if (this.OnSubscriptionError != null)
            {
                this.OnSubscriptionError(this, eventArgs);
            }
        }
        /// <summary>
        /// Issues the subscription failures.
        /// </summary>
        /// <param name="gseResponse">The GetStreamingEvents response.</param>
        private void IssueSubscriptionFailures(GetStreamingEventsResponse gseResponse)
        {
            ServiceResponseException exception = new ServiceResponseException(gseResponse);

            foreach (string id in gseResponse.ErrorSubscriptionIds)
            {
                StreamingSubscription subscription = null;

                lock (this.lockObject)
                {
                    // Client can do any good or bad things in the below event handler
                    if (this.subscriptions != null && this.subscriptions.ContainsKey(id))
                    {
                        subscription = this.subscriptions[id];
                    }
                }

                if (subscription != null)
                {
                    SubscriptionErrorEventArgs eventArgs = new SubscriptionErrorEventArgs(
                        subscription,
                        exception);

                    if (this.OnSubscriptionError != null)
                    {
                        this.OnSubscriptionError(this, eventArgs);
                    }
                }

                if (gseResponse.ErrorCode != ServiceError.ErrorMissedNotificationEvents)
                {
                    // Client can do any good or bad things in the above event handler
                    lock (this.lockObject)
                    {
                        if (this.subscriptions != null && this.subscriptions.ContainsKey(id))
                        {
                            // We are no longer servicing the subscription.
                            this.subscriptions.Remove(id);
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: Sluchaj.cs プロジェクト: KamilZet/zalacznikX
        private static void OnDisconnect(object sender, SubscriptionErrorEventArgs args)
        {
            ((StreamingSubscriptionConnection)sender).Open();

            #region user interaction on disconnecting (OFF)
            //ConsoleKeyInfo cki;
            //Console.WriteLine("The connection to the subscription is disconnected.");
            //Console.WriteLine("Do you want to reconnect to the subscription? Y/N");
            //while (true)
            //{
            //    cki = Console.ReadKey(true);
            //    {
            //        if (cki.Key == ConsoleKey.Y)
            //        {
            //            connection.Open();
            //            Console.WriteLine("Connection open.");
            //            Console.WriteLine("\r\n");
            //            break;
            //        }
            //        else if (cki.Key == ConsoleKey.N)
            //        {
            //            Signal.Set();
            //            bool isOpen = connection.IsOpen;

            //            if (isOpen == true)
            //            {
            //            // Close the connection
            //            connection.Close();
            //            }
            //            else
            //            {
            //                break;
            //            }
            //        }
            //    }
            //}
            #endregion
        }
コード例 #4
0
 private void OnSubscriptionError(object sender, SubscriptionErrorEventArgs args)
 {
     Debug.WriteLine(args.Exception != null ? args.Exception.Message : "Subscription error");
 }
コード例 #5
0
 private void OnDisconnect(object sender, SubscriptionErrorEventArgs args)
 {
     if (isClosingControlled == false)
     {
         Debug.WriteLine(string.Format("Restoring connection for subscription collection {0}", this.TargetEwsUrl.ToString()));
         this._connection.Open();
     }
 }
コード例 #6
0
        private void OnDisconnect(object sender, SubscriptionErrorEventArgs args)
        {
            if (!_continueListening)
            {
                return;
            }

            //TODO add failure attempts drop out.

            Console.WriteLine("attempting to reconnect");
            ConnectToEws();
        }
コード例 #7
0
        /// <summary>
        /// Issues the general failure.
        /// </summary>
        /// <param name="gseResponse">The GetStreamingEvents response.</param>
        private void IssueGeneralFailure(GetStreamingEventsResponse gseResponse)
        {
            SubscriptionErrorEventArgs eventArgs = new SubscriptionErrorEventArgs(
                null,
                new ServiceResponseException(gseResponse));

            if (this.OnSubscriptionError != null)
            {
                this.OnSubscriptionError(this, eventArgs);
            }
        }
コード例 #8
0
        /// <summary>
        /// Issues the subscription failures.
        /// </summary>
        /// <param name="gseResponse">The GetStreamingEvents response.</param>
        private void IssueSubscriptionFailures(GetStreamingEventsResponse gseResponse)
        {
            ServiceResponseException exception = new ServiceResponseException(gseResponse);

            foreach (string id in gseResponse.ErrorSubscriptionIds)
            {
                StreamingSubscription subscription = null;

                lock (this.lockObject)
                {
                    // Client can do any good or bad things in the below event handler
                    if (this.subscriptions != null && this.subscriptions.ContainsKey(id))
                    {
                        subscription = this.subscriptions[id];
                    }
                }

                if (subscription != null)
                {
                    SubscriptionErrorEventArgs eventArgs = new SubscriptionErrorEventArgs(
                        subscription,
                        exception);

                    if (this.OnSubscriptionError != null)
                    {
                        this.OnSubscriptionError(this, eventArgs);
                    }
                }

                if (gseResponse.ErrorCode != ServiceError.ErrorMissedNotificationEvents)
                {
                    // Client can do any good or bad things in the above event handler
                    lock (this.lockObject)
                    {
                        if (this.subscriptions != null && this.subscriptions.ContainsKey(id))
                        {
                            // We are no longer servicing the subscription.
                            this.subscriptions.Remove(id);
                        }
                    }
                }
            }
        }
コード例 #9
0
ファイル: Sluchaj.cs プロジェクト: KamilZet/zalacznikX
 static void OnError(object sender, SubscriptionErrorEventArgs args)
 {
     // Handle error conditions.
     Exception e = args.Exception;
     Log("Błąd. " + e.Message );
 }
コード例 #10
0
 private void OnDisconnect(object sender, SubscriptionErrorEventArgs args)
 {
     _meetingCacheService.ClearUpcomingAppointmentsForRoom(_roomAddress);
     IsActive = false;
     UpdateConnection();
 }