private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     Debug.WriteLine("Connection service closed");
     _connection.RequestReceived -= Connection_RequestReceived;
     _connection.ServiceClosed   -= Connection_ServiceClosed;
     _connection = null;
 }
Esempio n. 2
0
 private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
     {
         Application.Current.Shutdown();
     }));
 }
        private void OnServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
        {
            _appServiceConnection.RequestReceived -= OnRequestReceived;
            _appServiceConnection.ServiceClosed   -= OnServiceClosed;

            _appServiceConnection = null;
        }
Esempio n. 4
0
            public void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
            {
                SystrayApplicationContext s = new SystrayApplicationContext();

                s.connection.ServiceClosed -= Connection_ServiceClosed;
                s.connection = null;
            }
Esempio n. 5
0
 static void OnServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     connection.ServiceClosed -= OnServiceClosed;
     deferral.Complete();
     deferral   = null;
     connection = null;
 }
        /// <summary>
        /// Occurs when the other endpoint closes the connection to the app service
        /// </summary>
        private void OnConnectionClosed(AppServiceConnection sender, AppServiceClosedEventArgs args, int index)
        {
            ConnectionDeferral app_dc     = null;
            ConnectionDeferral desktop_dc = null;

            lock (thisLock)
            {
                if (connectionMap.ContainsKey(index))
                {
                    app_dc = connectionMap[index];
                    connectionMap.Remove(index);
                }
                if (desktopConnectionMap.ContainsKey(index))
                {
                    desktop_dc = desktopConnectionMap[index];
                    desktopConnectionMap.Remove(index);
                }
                if (taskCompletionSourceMap.ContainsKey(index))
                {
                    taskCompletionSourceMap[index].TrySetResult(false);
                }
            }
            if (app_dc != null)
            {
                app_dc.connection.Dispose();
                app_dc.deferral.Complete();
            }
            if (desktop_dc != null)
            {
                desktop_dc.connection.Dispose();
                desktop_dc.deferral.Complete();
            }
        }
Esempio n. 7
0
 private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
     {
         _connection?.Dispose();
         _connection = null;
     }));
 }
Esempio n. 8
0
		private void connectionClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
		{
			semaphoreSlim.Wait();
			isConnected = false;
			connection?.Dispose();
			setupConnection();
			semaphoreSlim.Release();
		}
Esempio n. 9
0
 /// <summary>
 /// Handles the event when the app service connection is closed
 /// </summary>
 private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     // connection to the UWP lost, so we shut down the desktop process
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
     {
         Application.Current.Shutdown();
     }));
 }
        private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
        {
            appServiceConnection.RequestReceived -= Connection_RequestReceived;
            appServiceConnection.ServiceClosed   -= Connection_ServiceClosed;
            appServiceConnection = null;

            ConnectionClosed?.Invoke(this);
        }
Esempio n. 11
0
 private void AppServiceconnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     if (_backgroundTaskDeferral != null)
     {
         // Complete the service deferral.
         _backgroundTaskDeferral.Complete();
     }
 }
Esempio n. 12
0
 private void LocalConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     if (localConnection != null)
     {
         localConnection.RequestReceived -= OnRequestReceived;
         localConnection.ServiceClosed   -= LocalConnection_ServiceClosed;
         localConnection = null;
     }
 }
        private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
        {
            if (_deferral != null)
            {
                _deferral.Complete();
            }

            _deferral = null;
        }
Esempio n. 14
0
 private void RemoteConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     if (remoteConnection != null)
     {
         remoteConnection.RequestReceived -= OnRequestReceived;
         remoteConnection.ServiceClosed   -= RemoteConnection_ServiceClosed;
         remoteConnection = null;
     }
 }
Esempio n. 15
0
 private void AppServiceconnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     if (_deferral != null)
     {
         // Complete the service deferral.
         _deferral.Complete();
         _deferral = null;
     }
 }
Esempio n. 16
0
 private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     g_AppServiceConnection = null;
     if (m_AppServiceDeferral != null)
     {
         // Complete the service deferral.
         m_AppServiceDeferral.Complete();
         m_AppServiceDeferral = null;
     }
 }
Esempio n. 17
0
        private async void OnServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
        {
            IsConnected = false;
            Debug.WriteLine("VoIPConnection.OnServiceClosed()");

            try
            {
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => await ConnectAsync());
            }
            catch { }
        }
Esempio n. 18
0
 private async void _connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         if (_connection != null)
         {
             _connection.Dispose();
             _connection = null;
         }
     });
 }
Esempio n. 19
0
 private async void OnServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         //Dispose the connection reference we're holding
         if (CashierServiceConnection != null)
         {
             CashierServiceConnection.Dispose();
             CashierServiceConnection = null;
         }
     });
 }
        private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
        {
            try
            {
                CurrentConnectionIndex = int.Parse(sender.AppServiceName);
                AppServiceDeferral     = AppServiceDeferrals[CurrentConnectionIndex];
                AppServiceDeferrals.Remove(CurrentConnectionIndex);

                if (AppServiceDeferral != null)
                {
                    AppServiceDeferral.Complete();
                    AppServiceDeferral = null;
                }
            }
            catch (Exception Ex)
            {
                Debug.WriteLine("AppServiceConnection_ServiceClosed error: " + Ex.Message);
            }
        }
Esempio n. 21
0
        public static void OnServiceClosed(object sender, AppServiceClosedEventArgs args)
        {
            var ctxts = App.Contexts.Where(ctx => ctx.Connection == sender);
            var ctxt  = ctxts.FirstOrDefault();

            if (ctxt == null)
            {
                return;
            }
            try
            {
                ctxt.Deferral.Complete();
            }
            catch (Exception)
            {
                //ignored
            }
            ctxt.DoFinal();
        }
        private async void OnUnderlyingConnectionClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
        {
            switch (args.Status)
            {
            case AppServiceClosedStatus.Completed:
                _disconnectReason = DisconnectReason.RemotePeerDisconnected;
                break;

            case AppServiceClosedStatus.Canceled:
            case AppServiceClosedStatus.ResourceLimitsExceeded:
                _disconnectReason = DisconnectReason.UnexpectedDisconnect;
                break;

            default:
                _disconnectReason = DisconnectReason.Unknown;
                break;
            }

            await DisposeAsync(); // TODO: Potentially dangerous 'await' in 'async void' method
        }
        /// <summary>
        /// Occurs when the other endpoint closes the connection to the app service
        /// </summary>
        private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
        {
            this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
            this.centennialConnection   = centennialConnections[this.currentConnectionIndex];
            this.centennialConnection.Dispose();
            centennialConnections.Remove(this.currentConnectionIndex);

            this.appServiceDeferral = appServiceDeferrals[this.currentConnectionIndex];
            appServiceDeferrals.Remove(this.currentConnectionIndex);
            this.centennialAppServiceDeferral = centennialAppServiceDeferrals[this.currentConnectionIndex];
            centennialAppServiceDeferrals.Remove(this.currentConnectionIndex);
            if (this.appServiceDeferral != null)
            {
                this.appServiceDeferral.Complete();
                this.appServiceDeferral = null;
            }
            if (this.centennialAppServiceDeferral != null)
            {
                this.centennialAppServiceDeferral.Complete();
                this.centennialAppServiceDeferral = null;
            }
        }
Esempio n. 24
0
 private async void _connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         if (_connection != null)
         {
             _connection.Dispose();
             _connection = null;
         }
     });
 }
Esempio n. 25
0
 /// <summary>
 /// Handler for the Service connection closed event from the AppServiceConnection
 /// </summary>
 /// <param name="sender">The AppConnection that is closing (i.e. this pointer)</param>
 /// <param name="args">any arguments for the service closure (unused)</param>
 private void ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     _log.Information($"AppService Connection has be closed by: {args.Status.ToString()}");
     Connection = null;
     Status     = AppServiceConnectionStatus.Unknown;
 }
Esempio n. 26
0
 private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     backgroundTaskDeferral?.Complete();
 }
 private async void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         //Dispose the connection reference we're holding
         if (connection != null)
         {
             connection.Dispose();
             connection = null;
         }
     });
 }
Esempio n. 28
0
 protected virtual void OnServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
 }
Esempio n. 29
0
 private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     Debug.WriteLine("HttpWebApiService has closed. Status is " + args.Status);
 }
 private void AppConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     _appConnection = null;
 }
Esempio n. 31
0
		private void connectionServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
		{
			isConnected = false;
		}
 private void _appServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     // If the service was closed, restart it
     _appServiceConnection = null;
     InitAppSvc();
 }
Esempio n. 33
0
 private static void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     // Signal the event so the process can shut down
     appServiceExit.Set();
 }
Esempio n. 34
0
 private void OnServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     new MessageDialog("Service closed").ShowAsync();
 }
Esempio n. 35
0
 private void AppConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     _appConnection = null;
 }
Esempio n. 36
0
 private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     are.Set();
 }
Esempio n. 37
0
 private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     backgroundTaskDeferral?.Complete();
 }
Esempio n. 38
0
 private static void InventoryService_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     m_appServiceExit.Set();
 }
 private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     _appServiceDeferral.Complete();
 }
Esempio n. 40
0
 private void AppServiceConnection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
 {
     _deferral.Complete();
 }