Exemplo n.º 1
0
        private void Exit()
        {
            try
            {
                MyPPT.clearImg();
            }
            catch (Exception e) { Log.Error(e.Message); }

            isExit = true;
            //2016-04-09
            Log.Info("From1.exit now...");
            try
            {
                if (m_db != null)
                {
                    m_db.Close();
                    m_db = null;
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            this.timer_lessonOff.Enabled = false;
            this.ShowInTaskbar           = false;
            this.notifyIcon1.Visible     = false;

            try
            {
                Process p = Process.GetCurrentProcess();
                if (p != null)
                {
                    Log.Info("From1 KillProcess now. pid=" + p.Id);
                    Thread.Sleep(1000);
                    p.Kill();
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            try
            {
                if (m_Host != null)
                {
                    m_Host.Close();
                    m_Host = null;
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            try
            {
                if (m_HttpdComet != null)
                {
                    m_HttpdComet.stop();
                    m_HttpdComet = null;
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            try
            {
                if (thread_comet != null)
                {
                    thread_comet.Abort();
                    thread_comet.Interrupt();
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            try
            {
                if (thread_Manage != null)
                {
                    thread_Manage.Abort();
                    thread_Manage.Interrupt();
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            try
            {
                if (thread_DeviceStatusCheck != null)
                {
                    thread_DeviceStatusCheck.Abort();
                    thread_DeviceStatusCheck.Interrupt();
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            try
            {
                if (fNotify != null)
                {
                    fNotify.Close();
                    fNotify = null;
                }
            }
            catch (Exception e) { Log.Error(e.Message); }

            try
            {
                if (f12 != null)
                {
                    f12.Close();
                    f12 = null;
                }
                Application.Exit();
            }
            catch (Exception e) { Log.Error(e.Message); }


            Log.Info("From1 exit over.");
        }