Esempio n. 1
0
            /// <summary>
            /// matchMakerStateChanged is the event handler that takes care of detecting when the matchmaker
            /// gets removed from the data base. When this happens, there is no other option but to shutdown the
            /// platform
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="args"></param>
            private void matchMakerStateChanged(object sender, LocalEndpointStateChangedEventArgs args)
            {
                AcdPlatform platform = _matchMaker._platform;
                AcdLogger   logger   = _matchMaker._logger;

                if (args.Reason == LocalEndpointStateTransitionReason.OwnerDisabledOrRemoved)
                {
                    if (null != platform)
                    {
                        platform.BeginShutdown(ar => { platform.EndShutdown(ar); }, null);

                        if (null != logger)
                        {
                            logger.Log("AcdAgentMatchMaker: Contact has been moved or removed, shutting down the application.");
                        }
                    }
                    else
                    {
                        if (null != logger)
                        {
                            _matchMaker._logger.Log("AcdAgentMatchMaker: Contact has been moved or removed, but the platform is null. Cannot shut down the application.");
                        }
                    }
                }
            }
Esempio n. 2
0
 private void EndpointStateChanged(object sender, LocalEndpointStateChangedEventArgs e)
 {
     if (e.State == LocalEndpointState.Terminating)
     {
         this.BeginShutdown(ar => this.EndShutdown(ar), null);
     }
 }
Esempio n. 3
0
 // Record the endpoint state transitions to the console.
 void Endpoint_StateChanged(object endpoint, LocalEndpointStateChangedEventArgs e)
 {
     // When the endpoint is terminated because of a contact being deleted,
     // the application receives Terminating and Terminated state changes.
     Console.WriteLine("Endpoint has changed state. The previous endpoint state was: "
                       + e.PreviousState + " and the current state is: " + e.State);
 }
Esempio n. 4
0
 internal void OnPortalEndpointStateChanged(object sender, LocalEndpointStateChangedEventArgs args)
 {
     switch (args.Reason)
     {
     case LocalEndpointStateTransitionReason.OwnerDisabledOrRemoved:
         this.BeginShutdown(sd => { this.EndShutdown(sd); }, null);
         break;
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Record the endpoint state transitions to the console.
        /// </summary>
        /// <param name="sender">Endpoint that saw its state change.</param>
        /// <param name="e">Data about the endpoint state change event.</param>
        private void _endpoint_StateChanged(object sender, LocalEndpointStateChangedEventArgs e)
        {
            // Extract the endpoint that sent the state change event.
            ApplicationEndpoint endpoint = sender as ApplicationEndpoint;

            UCMASampleHelper.WriteLine("Endpoint (" + endpoint.OwnerUri
                                       + ") has changed state. The previous endpoint state was '"
                                       + e.PreviousState + "' and the current state is '" + e.State + "'.");
        }
Esempio n. 6
0
        /// <summary>
        /// Endpoint state changed event handler
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">Event args.</param>
        private void Endpoint_StateChanged(object sender, LocalEndpointStateChangedEventArgs e)
        {
            LocalEndpoint endpoint = sender as LocalEndpoint;

            Helper.Logger.Info("Endpoint {0} state changed from {1} to {2}. Reason = {3}.", endpoint.OwnerUri, e.PreviousState, e.State, e.Reason);

            if (e.State == LocalEndpointState.Terminating)
            {
                //Unregister event handlers.
                this.UnregisterEndpointEventHandlers(endpoint);
            }
        }
Esempio n. 7
0
        private void UserEndpointStateChanged(object sender, LocalEndpointStateChangedEventArgs e)
        {
            UserEndpoint    userEndpoint = sender as UserEndpoint;
            RealTimeAddress ownerAddress = new RealTimeAddress(userEndpoint.OwnerUri);

            if (e.State == LocalEndpointState.Terminating)
            {
                lock (this.SyncRoot)
                {
                    // Lost the cache.
                    if (m_userEndpoints.ContainsKey(ownerAddress))
                    {
                        m_userEndpoints.Remove(ownerAddress);
                        m_userEndpointReferenceCounts.Remove(ownerAddress);
                    }
                }
            }
        }
Esempio n. 8
0
 // Record the endpoint state transitions to the console.
 static void Endpoint_StateChanged(object endpoint, LocalEndpointStateChangedEventArgs e)
 {
     // When the endpoint is terminated because of a contact being deleted,
     // the application receives Terminating and Terminated state changes.
     Console.WriteLine("Endpoint has changed state. The previous endpoint state was: " + e.PreviousState + " and the current state is: " + e.State);
 }
 private void _appEndpoint_StateChanged(object sender, LocalEndpointStateChangedEventArgs e)
 {
     _logger.Log("Application endpoint state changed from {0} to {1}", e.PreviousState, e.State);
 }
 private void _appEndpoint_StateChanged(object sender, LocalEndpointStateChangedEventArgs e)
 {
     Console.WriteLine("Application endpoint state changed from {0} to {1}", e.PreviousState, e.State);
 }