示例#1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    ControllerManager.RemoveAllController();
                    ChannelManager.RemoveAllChannel();

                    ICollection <IRunDevice> devs = DeviceManager.GetValues();
                    foreach (IRunDevice dev in devs)
                    {
                        dev.Exit();
                    }

                    DeviceManager.RemoveAllDevice();
                }

                _monitorException.UnMonitor();

                IsDisposed = true;

                Logger.InfoFormat(false, "{0}-{1}", ServerName, "已经停止");
            }
        }
示例#2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    ControllerManager.RemoveAllController();
                    ChannelManager.RemoveAllChannel();

                    ICollection <IRunDevice> devs = DeviceManager.GetValues();
                    foreach (IRunDevice dev in devs)
                    {
                        dev.Exit();
                    }

                    DeviceManager.RemoveAllDevice();

                    if (_Shows != null)
                    {
                        foreach (KeyValuePair <string, IGraphicsShow> show in _Shows)
                        {
                            try
                            {
                                show.Value.Close();
                            }
                            catch
                            {
                                // ignored
                            }
                        }
                        _Shows.Clear();
                    }

                    if (_Services != null)
                    {
                        foreach (KeyValuePair <string, IService> service in _Services)
                        {
                            try
                            {
                                service.Value.StopService();
                            }
                            catch
                            {
                                // ignored
                            }
                        }
                        _Services.Clear();
                    }
                }

                _monitorException.UnMonitor();

                IsDisposed = true;

                Logger.InfoFormat(false, "{0}-{1}", ServerName, "已经停止");
            }
        }
示例#3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    ControllerManager.RemoveAllController();
                    ChannelManager.RemoveAllChannel();

                    ICollection <IRunDevice> devs = DeviceManager.GetValues();

                    Parallel.ForEach(devs, d =>
                    {
                        try
                        {
                            d.Exit();
                        }
                        catch (Exception ex)
                        {
                            this.Logger.Error(true, "", ex);
                        }
                    });

                    Parallel.ForEach(_Services, service =>
                    {
                        try
                        {
                            service.Value.StopService();
                        }
                        catch (Exception ex)
                        {
                            this.Logger.Error(true, "", ex);
                        }
                    });

                    Parallel.ForEach(_Shows, show =>
                    {
                        try
                        {
                            show.Value.Close();
                        }
                        catch (Exception ex)
                        {
                            this.Logger.Error(true, "", ex);
                        }
                    });

                    DeviceManager.RemoveAllDevice();
                    _Services.Clear();
                    _Shows.Clear();

                    #region  用

                    /*
                     * if (_Shows != null)
                     * {
                     *  foreach (KeyValuePair<string, IGraphicsShow> show in _Shows)
                     *  {
                     *      try
                     *      {
                     *          show.Value.Close();
                     *      }
                     *      catch
                     *      {
                     *          // ignored
                     *      }
                     *  }
                     *  _Shows.Clear();
                     * }
                     *
                     * if (_Services != null)
                     * {
                     *  foreach (KeyValuePair<string, IService> service in _Services)
                     *  {
                     *      try
                     *      {
                     *          service.Value.StopService();
                     *      }
                     *      catch
                     *      {
                     *          // ignored
                     *      }
                     *  }
                     *  _Services.Clear();
                     * }*/
                    #endregion
                }
                _monitorException.UnMonitor();

                IsDisposed = true;

                Logger.InfoFormat(false, "{0}-{1}", ServerName, "已经停止");
            }
        }
示例#4
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                this.AddDeviceCompleted    = null;
                this.DeleteDeviceCompleted = null;
                this.ComClosed             = null;
                this.ComOpened             = null;
                this.SocketClosed          = null;
                this.SocketConnected       = null;

                if (disposing)
                {
                    ControllerManager.RemoveAllController();

                    ChannelManager.RemoveAllChannel();

                    ServiceManager.RemoveAllService();

                    foreach (KeyValuePair <string, IGraphicsShow> show in GraphicsShowManager)
                    {
                        try
                        {
                            show.Value.CloseGraphics();
                        }
                        catch (Exception ex)
                        {
                            this.Logger.Error(true, "", ex);
                        }

                        try
                        {
                            show.Value.Dispose();
                        }
                        catch (Exception ex)
                        {
                            this.Logger.Error(true, "", ex);
                        }
                    }


                    foreach (IRunDevice runDev in DeviceManager)
                    {
                        try
                        {
                            runDev.Exit();
                        }
                        catch (Exception ex)
                        {
                            this.Logger.Error(true, "", ex);
                        }
                        try
                        {
                            runDev.Dispose();
                        }
                        catch (Exception ex)
                        {
                            this.Logger.Error(true, "", ex);
                        }
                    }


                    if (_deviceContainer != null)
                    {
                        _deviceContainer.Dispose();
                    }
                }

                _monitorException.UnMonitor();

                IsDisposed = true;

                Logger.InfoFormat(false, "{0}-{1}", ServerName, "已经停止");
            }
        }