コード例 #1
0
 // For dealing with shutdown signal
 private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs ev)
 {
     try
     {
         Globals.log.Debug("Exit Program because Receive SystemEvents_SessionEnding=" + ev.Reason.ToString());
         if (Environment.HasShutdownStarted || (ev.Reason == SessionEndReasons.SystemShutdown))
         {
             ev.Cancel = true;
             //Tackle Shutdown
             ComputerInfo.SubmitComputerLog(ComputerInfo.SubmitComputerLogMode.Logoff);
             ev.Cancel = false;
         }
         else if (ev.Reason == SessionEndReasons.Logoff)
         {
             //Tackle log off
             ComputerInfo.SubmitComputerLog(ComputerInfo.SubmitComputerLogMode.Logoff);
         }
         else
         {
             ComputerInfo.SubmitComputerLog(ComputerInfo.SubmitComputerLogMode.Logoff);
         }
     }
     catch (Exception e)
     {
         Globals.log.Error(e.ToString());
     }
 }
コード例 #2
0
        private void OnExit(object sender, EventArgs ev)
        {
            try
            {
                Globals.log.Debug("Start OnExit()");

                RabbitMQWrapper.BlnThreadAborted = true;

                Globals.blnExitByUser = true;

                ComputerInfo.SubmitComputerLog(ComputerInfo.SubmitComputerLogMode.Logoff);


                ComputerInfo.ThreadMainExit();

                threadComputerInfo.Abort();

                UserActivityThread.blnThreadAborted = true;
                threadUserActivity.Abort();

                if (Globals.EnabledCaptureSceen)
                {
                    //~ Auto exit()
                    //No CaptureScreen.blnThreadAborted = true;
                    Globals.log.Debug("Try Exit capture screen");

                    //CaptureScreenThread.Exit();
                }



                formDummy.Close();



                Globals.log.Debug("Finish OnExit()");
                Application.Exit();
            }
            catch (Exception e)
            {
                Globals.log.Error(e.ToString());
            }
        }
コード例 #3
0
        public AmivoiceWatcher()
        {
            try
            {
#if DEBUG
                Console.WriteLine("Mode=Debug");
                //DebugHelper();
#endif

                Globals.CreateAllDirectoryAndFiles();

                Configuration_SetFile();

                InitializeGUI();

                //~ Start thread
                ComputerInfo.SubmitComputerLog(ComputerInfo.SubmitComputerLogMode.Startup);

                //~ Start UserActivityThread
                threadUserActivity = new Thread(new ThreadStart(UserActivityThread.ThreadMain));
                threadUserActivity.Start();

                threadComputerInfo = new Thread(new ThreadStart(ComputerInfo.ThreadMain));
                threadComputerInfo.Start();

                threadRabbitMQ = new Thread(new ThreadStart(RabbitMQWrapper.ThreadMain));
                threadRabbitMQ.Start();

#if DEBUG
                Globals.Notifications.PopupWelcomeMessage();
#endif



                //DONT DELETE
                //StartCaptureScreenRecord();
            }
            catch (Exception e)
            {
                Globals.log.Error(e.ToString());
            }
        }