Esempio n. 1
0
        /// <summary>
        /// Fires when the service is stopped
        /// </summary>
        protected override void OnStop()
        {
            if (_host != null)
            {
                //Try and connect to the WCF service and call its stop method
                try
                {
                    if (_plexService == null)
                    {
                        connect();
                    }

                    if (_plexService != null)
                    {
                        _plexService.Stop();
                        disconnect();
                    }
                }
                catch { }
                try
                {
                    _host.Close();
                }
                finally
                {
                    _host = null;
                }
            }
            TrayInteraction.WriteToLog("Plex Service Stopped");
            base.OnStop();
        }
Esempio n. 2
0
 /// <summary>
 /// Stop Plex
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void StopPlex_Click(object sender, EventArgs e)
 {
     //stop it
     if (_plexService != null)
     {
         try
         {
             _plexService.Stop();
         }
         catch
         {
             Disconnect();
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Fires when the service is stopped
        /// </summary>
        protected override void OnStop()
        {
            if (_host != null)
            {
                //Try and connect to the WCF service and call its stop method
                try
                {
                    if (_plexService == null)
                    {
                        Connect();
                    }

                    if (_plexService != null)
                    {
                        _plexService.Stop();
                        //wait for plex to stop for 10 seconds
                        if (!_stopped.WaitOne(10000))
                        {
                            TrayInteraction.WriteToLog("Timed out waiting for plex to stop");
                        }
                        Disconnect();
                    }
                }
                catch { }
                try
                {
                    _host.Close();
                }
                finally
                {
                    _host = null;
                }
            }
            TrayInteraction.WriteToLog("Plex Service Stopped");
            base.OnStop();
        }