// 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) { } } }
// 在此事件中决定是否关机或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; } }
/// <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; } }
// Constructor. public SessionEndingEventArgs(SessionEndReasons reason) { this.reason = reason; this.cancel = false; }
// Constructors public SessionEndingEventArgs(SessionEndReasons reason) { }
/// <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; }
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; }
public void OnSystemShutdown(SessionEndReasons reason) { PushUp("SERVICE", reason == SessionEndReasons.SystemShutdown ? "SYSTEM_SHUTDOWN" : "SESSION_LOGOFF"); }
public SessionEndedEventArgs(SessionEndReasons reason) { }
public SessionEndedEventArgs(SessionEndReasons reason) { throw new NotImplementedException(); }