Пример #1
0
        // 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
        // 在此事件中决定是否关机或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;
            }
        }
Пример #3
0
        /// <summary>
        /// 接管用户关机/注销
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            if (!allowShutDown)
            {
                e.Cancel = true;
                generateEmail();
                Shutdown();
            }
            SessionEndReasons reason = e.Reason;

            switch (reason)
            {
            case SessionEndReasons.Logoff:
                AppendLog("用户正在注销。操作系统继续运行,但启动此应用程序的用户正在注销。");
                break;

            case SessionEndReasons.SystemShutdown:
                AppendLog("操作系统正在关闭");
                break;
            }
        }
        public void SignalsSessionEnded(int lParam, SessionEndReasons reason)
        {
            bool signaled = false;
            SessionEndedEventArgs    args         = null;
            SessionEndedEventHandler endedHandler = (o, e) =>
            {
                signaled = true;
                args     = e;
            };

            SystemEvents.SessionEnded += endedHandler;

            try
            {
                SendMessage(true, lParam);
                Assert.True(signaled);
                Assert.NotNull(args);
                Assert.Equal(reason, args.Reason);
            }
            finally
            {
                SystemEvents.SessionEnded -= endedHandler;
            }
        }
Пример #5
0
 // Constructor.
 public SessionEndingEventArgs(SessionEndReasons reason)
 {
     this.reason = reason;
     this.cancel = false;
 }
 // Constructors
 public SessionEndingEventArgs(SessionEndReasons reason)
 {
 }
Пример #7
0
 /// <devdoc>
 /// <para>Initializes a new instance of the <see cref='Microsoft.Win32.SessionEndingEventArgs'/> class.</para>
 /// </devdoc>
 public SessionEndingEventArgs(SessionEndReasons reason)
 {
     _reason = reason;
 }
		public SessionEndedEventArgs (SessionEndReasons reason)
		{
			this.myreason = reason;
		}
Пример #9
0
 public SessionEndedEventArgs(SessionEndReasons reason)
 {
     this.myreason = reason;
 }
 /// <devdoc>
 /// <para>Initializes a new instance of the <see cref='Microsoft.Win32.SessionEndingEventArgs'/> class.</para>
 /// </devdoc>
 public SessionEndingEventArgs(SessionEndReasons reason) {
     this.reason = reason;
 }
Пример #11
0
 public void OnSystemShutdown(SessionEndReasons reason)
 {
     PushUp("SERVICE", reason == SessionEndReasons.SystemShutdown ? "SYSTEM_SHUTDOWN" : "SESSION_LOGOFF");
 }
Пример #12
0
 public SessionEndedEventArgs(SessionEndReasons reason)
 {
 }
	// Constructor.
	public SessionEndingEventArgs(SessionEndReasons reason)
			{
				this.reason = reason;
				this.cancel = false;
			}
Пример #14
0
 public SessionEndedEventArgs(SessionEndReasons reason)
 {
     throw new NotImplementedException();
 }