private void SystemEventsOnSessionEnding(object sender, SessionEndingEventArgs e) { if (e.Reason == SessionEndReasons.SystemShutdown || e.Reason == SessionEndReasons.Logoff) { Toggl.SetOSShutdown(); } }