示例#1
0
文件: Form1.cs 项目: NE1W01F/EXE
        // Token: 0x0600000E RID: 14 RVA: 0x000028CC File Offset: 0x00000ACC
        private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            SessionEndReasons reason            = e.Reason;
            SessionEndReasons sessionEndReasons = reason;

            if (sessionEndReasons != SessionEndReasons.Logoff)
            {
                if (sessionEndReasons == SessionEndReasons.SystemShutdown)
                {
                    try
                    {
                        Form1.Unprotect();
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            else
            {
                try
                {
                    Form1.Unprotect();
                }
                catch (Exception)
                {
                }
            }
        }
示例#2
0
 void SystemEvents_SessionEnded(object sender, SessionEndingEventArgs e)
 {
     if (e.Reason == SessionEndReasons.SystemShutdown || e.Reason == SessionEndReasons.Logoff)
     {
         createData("shutdown");
     }
 }
示例#3
0
        // 在此事件中决定是否关机或logoff
        private void SessionEndingEvent(object sender, SessionEndingEventArgs e)
        {
            SessionEndReasons endReasons = e.Reason;

            if (IsPass)
            {
                // 会关机或logoff
                e.Cancel = false;
            }
            else
            {
                // 不会关机或logoff
                e.Cancel = true;
            }
            switch (endReasons)
            {
            case SessionEndReasons.Logoff:
                return;

            case SessionEndReasons.SystemShutdown:
                return;

                break;

            default:
                return;

                break;
            }
        }
示例#4
0
 private static void SystemEventsOnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     EffectManager.Instance.StopEffect();
     EffectManager.Instance.Uninitialise();
     Application.ApplicationExit -= ApplicationOnApplicationExit;
     SystemEvents.SessionEnding  -= SystemEventsOnSessionEnding;
 }
示例#5
0
 private void OnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (m_evHandler != null)
     {
         m_evHandler(sender, new SessionLockEventArgs(SessionLockReason.Ending));
     }
 }
示例#6
0
 private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     try
     {
         string siteUrl        = "http://" + site + ".xyz/pc/pckontrol/" + MAC + "/0";
         var    httpWebRequest = (HttpWebRequest)WebRequest.Create(siteUrl);
         httpWebRequest.ContentType = "application/json";
         httpWebRequest.Method      = "GET";
         var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
         if (httpResponse.StatusCode == HttpStatusCode.OK)
         {
             //  Console.WriteLine("Kapatıldı");
         }
     }
     catch (Exception Exc)
     {
         errorLine = "IP: " + IP + Environment.NewLine + "MAC: " + MAC + Environment.NewLine + "WORKGROUP: " + work + Environment.NewLine
                     + "PC: " + pcadi + Environment.NewLine + "Hata: " + Exc.Message + Environment.NewLine + "Program: " + prgName + Environment.NewLine
                     + "Tarih: " + DateTime.Now.ToString() + Environment.NewLine + "------------------------------------" + Environment.NewLine;
         string file_path = @winDirShortVersion + @":\n0kayip\Logs\error_log.txt";
         //  Process.Start(@winDirShortVersion + @":\n0kayip\GPS.exe");
         System.IO.File.AppendAllText(file_path, errorLine);
         PcKapat();
     }
 }
 // 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());
     }
 }
示例#8
0
    private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
    {
        Log.Write(LogLevel.Trace, "Reason: {0}", e.Reason);
        var mainForm = Instance.MainForm;

        mainForm.SaveAll();
    }
示例#9
0
 public static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     lock (sync)
     {
         isShutDown = true;
     }
 }
示例#10
0
 public static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (Convert.ToBoolean(Settings.BS_OD) && Methods.IsAdmin())
     {
         Exit();
     }
 }
 void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (Environment.HasShutdownStarted)
     {
         MessageBox.Show("Total amount of time the system logged on:" + ClockTextBlock.Text);
     }
 }
示例#12
0
        static void OnSessionEnding(object sender, SessionEndingEventArgs e)
        {
            try
            {
                DialogResult result = MessageBox.Show("Haben Sie wirklich alles erledigt?", "Erinnerung", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                switch (result)
                {
                case DialogResult.Yes:
                    ProcessStartInfo psi = new ProcessStartInfo("shutdown", "/s /t 0")
                    {
                        CreateNoWindow  = true,
                        UseShellExecute = false
                    };
                    Process.Start(psi);
                    break;

                case DialogResult.No:
                    MessageBox.Show("Es wird jetzt ein leeres Fenster im Editor geöffnet. Sobald Sie erledigt haben, was Sie noch tun wollten, schließen Sie dieses bitte. Erst dann wird der Computer herunterfahren.", "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Process process = new Process();
                    process.StartInfo.FileName    = "notepad.exe";
                    process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
                    process.Start();
                    process.WaitForExit();
                    break;

                default:
                    MessageBox.Show("Unbekannter Fehler.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    break;
                }
            }
            catch (Exception fehler)
            {
                MessageBox.Show("Fehler:" + Environment.NewLine + fehler.Message + Environment.NewLine + "Bitte wenden Sie sich an Ihren Systemadministrator.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#13
0
 public static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (Convert.ToBoolean(Plugin.BDOS) && Methods.IsAdmin())
     {
         ProcessCriticalExit();
     }
 }
示例#14
0
 /// <summary>
 /// Handles the SessionEnding event of the SystemEvents control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="SessionEndingEventArgs"/> instance containing the event data.</param>
 static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (e.Reason == SessionEndReasons.SystemShutdown)
     {
         Shutdown();
     }
 }
示例#15
0
 private void OnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (m_evHandler != null)
     {
         m_evHandler(sender, e);
     }
 }
示例#16
0
 private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     foreach (Listener l in _listeners)
     {
         l.Setter(new byte[] { 1, 5, 0, 0, 0, 0 });
     }
 }
示例#17
0
 private void OnShutDown(object s, SessionEndingEventArgs e)
 {
     if (e.Reason == SessionEndReasons.SystemShutdown)
     {
         TVOff();
     }
 }
 /// <summary>
 /// Handles the SessionEnding event of the SystemEvents control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="SessionEndingEventArgs"/> instance containing the event data.</param>
 static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (e.Reason == SessionEndReasons.SystemShutdown || !_isRunningAsService)
     {
         Shutdown();
     }
 }
示例#19
0
文件: Program.cs 项目: ykebaili/Timos
 static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     try
     {
         CSessionClient.GetSessionUnique().CloseSession();
     }
     catch { }
 }
示例#20
0
 private void SystemEventsOnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (e.Reason == SessionEndReasons.SystemShutdown ||
         e.Reason == SessionEndReasons.Logoff)
     {
         Toggl.SetOSShutdown();
     }
 }
示例#21
0
 protected static void OnSessionEnding(Object sender, SessionEndingEventArgs e)
 {
     /* I suggest using SchwabenCode.EasySmtp as it is very easy to use and implements the IDisposable interface.  If that is not an option, than simply use SmtpClient class */
     if (e.Reason == SessionEndReasons.SystemShutdown)
     {
         // Send SMS message to yourself notifying shutdown is occurring on server
     }
 }
示例#22
0
        void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            ServiceController service = new ServiceController("OpenVPNService", "Localhost");

            if (service.Status != ServiceControllerStatus.Running && service.Status != ServiceControllerStatus.StartPending)
            {
                service.Start();
            }
        }
示例#23
0
        public void Deny_Unrestricted()
        {
            SessionEndingEventArgs seea = new SessionEndingEventArgs(SessionEndReasons.SystemShutdown);

            Assert.AreEqual(SessionEndReasons.SystemShutdown, seea.Reason, "Reason");
            Assert.IsFalse(seea.Cancel, "Cancel-false");
            seea.Cancel = true;
            Assert.IsTrue(seea.Cancel, "Cancel-true");
        }
示例#24
0
        }//Service_ServiceAdded()

        //
        //
        #endregion//Event Handlers


        #region Win32 SystemEvent handlers
        //
        //
        //
        // ****             SystemEvents_SessionEnding()                ****
        private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            if (m_FrontEndServer != null)
            {
                m_FrontEndServer.Log.NewEntry(LogLevel.Major, "Violet.SystemEvents_SessionEnding: {0} ", e);
            }
            e.Cancel = true;
            BeginShutDown();
        }
示例#25
0
 private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     try {
         StopProxy(systemSessionEnding: true, millisecondsTimeout: 5000);
     } catch (Exception exception) {
         LogError($"Fail to stop the proxy: {exception.Message}");
         // continue
     }
 }
示例#26
0
文件: Auto3D.cs 项目: caomw/Auto3D
        // system was shut down through Windows GUI

        void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            Log.Debug("Auto3D: SessionEnding");

            if (e.Reason == SessionEndReasons.SystemShutdown)
            {
                SystemShutDown();
            }
        }
        private void OnAppSessionEnding(object sender, SessionEndingEventArgs e)
        {
            m_logger.Info("Session ending.");

            // THIS MUST BE DONE HERE ALWAYS, otherwise, we get BSOD.
            CriticalKernelProcessUtility.SetMyProcessAsNonKernelCritical();

            Environment.Exit((int)ExitCodes.ShutdownWithSafeguards);
        }
示例#28
0
        protected static void SessionEndingEvtHandler(object sender, SessionEndingEventArgs e)
        {
            if (e.Reason == SessionEndReasons.Logoff)
            {
                //Process.Start("shutdown", "-a");
            }

            CancelShutdown();
            new Formulario().Show();
        }
示例#29
0
        protected void systemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            string logoutmsg = this.reqUtil.getLogoutMsg();

            if (logoutmsg != "已处于下线")
            {
                this.reqUtil.logout();
            }
            e.Cancel = false;
        }
示例#30
0
        private void Windows_SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            // This event will only be triggered if you run Wasabi from the published package. Use the packager with the --onlybinaries option.
            Logger.LogInfo($"Process termination was requested by the OS, reason '{e.Reason}'.");
            e.Cancel = true;

            // This must be a blocking call because after this the OS will terminate the Wasabi process if it exists.
            // The process will be killed by the OS after ~7 seconds, even with e.Cancel = true.
            Terminate();
        }