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");
		}
Beispiel #2
0
        void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            this.Shutdown = true;

            this.KillScadaProcess(new string[]
                {
                    "MDS.exe",
                    "AIS.exe",
                    "Scada.*",
                });
        }
Beispiel #3
0
        void SystemEvents_SessionEnding(object sender, Microsoft.Win32.SessionEndingEventArgs e)
        {
            switch (e.Reason)
            {
            case SessionEndReasons.Logoff:
                Logger.LogMessage("Log-off", -1);
                break;

            case SessionEndReasons.SystemShutdown:
                Logger.LogMessage("Shutdown", -1);
                break;
            }
            Stop();
        }
Beispiel #4
0
 /// <summary>
 /// 시스템 종료시 프로세스 종료
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SystemEvents_SessionEnding(object sender, Microsoft.Win32.SessionEndingEventArgs e)
 {
     try
     {
         if (connection.IsConnected)
         {
             ProcessLogOut();
         }
         Process.GetCurrentProcess().Kill();
     }
     catch (Exception ex)
     {
         Logger.error(ex.ToString());
     }
 }
Beispiel #5
0
        public void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            // This event occurs when the user is trying to log off or shut down
            // the system.

            // If you are using SessionEnding in a Windows form to detect
            // a system logoff or reboot, there is no deterministic way to decide
            // whether the Closing event will fire before this event.
            // If you want to perform some special tasks before Closing is fired,
            // you need to ensure that SessionEnding fires before Closing. To do this,
            // you need to trap the WM_QUERYENDSESSION in the form by overriding the
            // WndProc function (see the example in Help)

            // Because this is a static event, you must detach your event handlers
            // when your application is disposed, or memory leaks will result.

            // NOTE: Ovaj event je bio potreban u NET 1.1 (da bi se proverilo da li
            // u otvorenim formama ima neceg sto bi trebalo snimiti), ali se u NET 2.0
            // moze koristiti event FormClosing (slucaj kada je e.CloseReason ==
            //  CloseReason.WindowsShutDown)
        }
 private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     Disable();
 }
Beispiel #7
0
        /// <summary>Prevents the system from shutting down until the installation is safely stopped.</summary>
        /// <param name="sender">The object that called the event.</param>
        /// <param name="e">The <see cref="Microsoft.Win32.SessionEndingEventArgs" /> instance containing the event data.</param>
        static void PreventClose(object sender, SessionEndingEventArgs e)
        {
            if (notifyIcon != null)
            {
                notifyIcon.Visible = false;
                notifyIcon.Dispose();
                notifyIcon = null;
            }

            using (
                FileStream fs =
                    File.Create(Path.Combine(Environment.ExpandEnvironmentVariables("%WINDIR%"), "Temp", "abort.lock")))
            {
                fs.WriteByte(0);
            }

            e.Cancel = true;
        }
Beispiel #8
0
 private void OnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     StopWatch();
 }
 private void OnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     if(m_evHandler != null) m_evHandler(sender, e);
 }
Beispiel #10
0
 /// <summary>
 /// Evento de cierre de sesión
 /// </summary>
 /// <param name="sender">Objeto que lanza el evento</param>
 /// <param name="e">Argumentos del evento</param>
 private void SessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (e.Reason == SessionEndReasons.SystemShutdown)
     {
         this.StopAll("System shutdown");
     }
 }
Beispiel #11
0
 // Event handlers
 void OnSessionEnding(object obj, SessionEndingEventArgs seea)
 {
     seea.Cancel = !OkToTrash();
 }
 /// <summary>
 /// Event handler for the SessionEnding event
 /// Attempt to save the settings
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     smf.Exit();
     saveSettings();
 }
Beispiel #13
0
 /// <summary>
 /// Handles the SessionEnding events, allowing the client to terminate if the system
 /// is shutting down but not be affected if the user is simply logging off.
 /// </summary>
 /// <param name="sender">The object related to the event.</param>
 /// <param name="e">The arguments related to the event.</param>
 private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     try
     {
         if(e.Reason == SessionEndReasons.SystemShutdown)
         {
             Client client = Client.Instance();
             client.mustTerminate = true;
             e.Cancel = false;
         }
     }
     catch
     {}
 }
Beispiel #14
0
		private void SessionEndingCallback (object o, SessionEndingEventArgs args)
		{
		}
Beispiel #15
0
        //=========================================================================
        ///	<summary>
        ///		OSのセッション終了時のハンドラ
        /// </summary>
        /// <remarks>
        ///		放送時間直前や放送中ならシャットダウンを拒否する。
        /// </remarks>
        /// <history>2008/03/26 新規作成</history>
        //=========================================================================
        private static void OnSessionClosing( object sender, SessionEndingEventArgs args )
        {
            Logger.Output( "Windowsセッション終了" );

            //// <TEST> 2009/03/25 ->
            //            if (true)
            //            {
            //                MessageBox.Show("シャットダウンをキャンセルしました。");
            //                Logger.Output("...放送中または直前のため終了をキャンセルします");
            //                args.Cancel = true;
            //                return;
            //            }
            //// <TEST> 2009/03/25 <-

            Cleanup();	// メッセージループを出てからでは間に合わない場合がある

            Application.Exit();
        }
Beispiel #16
0
 void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     kill();
 }
Beispiel #17
0
 static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     SystemProcess.SetCritical(false); //Anti-BSOD
 }
 private int OnSessionEnding(IntPtr lParam)
 {
     SessionEndReasons systemShutdown = SessionEndReasons.SystemShutdown;
     if ((((long) lParam) & -2147483648L) != 0L)
     {
         systemShutdown = SessionEndReasons.Logoff;
     }
     SessionEndingEventArgs args = new SessionEndingEventArgs(systemShutdown);
     RaiseEvent(OnSessionEndingEvent, new object[] { this, args });
     return (args.Cancel ? 0 : 1);
 }
Beispiel #19
0
 void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     RedshiftProcess.Exited -= RedshiftProcess_Crashed;
 }
Beispiel #20
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 || !_isRunningAsService)
     {
         Shutdown();
     }
 }
		private void OnSessionEnding(object sender, SessionEndingEventArgs e)
		{
			if(m_evHandler != null)
				m_evHandler(sender, new SessionLockEventArgs(SessionLockReason.Ending));
		}
 static void SystemEventsSession(object sender, SessionEndingEventArgs sessionEndingEventArgs)
 {
     Application.Exit();
 }
Beispiel #23
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();
			}
		}
Beispiel #24
0
 public void OnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     Controller.CECActions.SuppressUpdates = true;
       Controller.Close();
 }
Beispiel #25
0
 public static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     Logger.Instance().Log( "Ended Hardware VoIP Monitor application" );
     Environment.Exit(1);
 }
Beispiel #26
0
    private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
    {
      switch (e.Reason)
      {
        case SessionEndReasons.Logoff:
          MapEvent(MappingEvent.PC_Logoff, false);
          break;

        case SessionEndReasons.SystemShutdown:
          MapEvent(MappingEvent.PC_Shutdown, false);
          break;
      }
    }
 /// <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>
 void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     // Try to shut down gracefully
     Shutdown();
 }
 private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     if (Environment.HasShutdownStarted)
     {
         //Tackle Shutdown
     }
     else
     {
         //Tackle log off
     }
     this.ApplicationExit();
 }
Beispiel #29
0
 private void OnSessionEnding(object sender, SessionEndingEventArgs e)
 {
     Quit();
 }
 void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     System.Windows.Forms.Application.Exit();
 }
Beispiel #31
0
 static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
 {
     Helper.SystemRestarter.Abort();
 }
Beispiel #32
0
 private void m00006d(object p0, SessionEndingEventArgs p1)
 {
     this.m000001();
     base.Exit();
 }