void CheckInTimer_Tick(object sender, System.EventArgs e) { DebugDetector.AssertCheckRunning(); MainForm.SetStatusBar("Checking in..."); var message = string.Empty; var ticket = string.Empty; var data = SessionNegotiator.GenerateCheckInData(); var result = SessionNegotiator.CheckIn(data, ref message, ref ticket); if (result != CheckInStatus.Ok) { //Close Allegiance AllegianceLoader.ExitAllegiance(); //Unlock form this.Enabled = true; MainForm.SetStatusBar(message); } else { MainForm.SetStatusBar(string.Format("Checked in at {0:h:mm tt}.", DateTime.Now)); } GC.Collect(); //Now is a decent time to force garbage collection }
public static void AssertCheckRunning() { #if !DEBUG if (Debugger.IsAttached || !IsCheckRunning) { //Exit Allegiance if it is running AllegianceLoader.ExitAllegiance(); KillProcess(); throw new Exception("Debug check not running."); } #endif }
private void Logout(bool closeAllegiance) { MainForm.SetStatusBar("Logged out"); //Stop timer CheckInTimer.Stop(); //Close Allegiance if (closeAllegiance) { AllegianceLoader.ExitAllegiance(); } //Tell the server you are logging out SessionNegotiator.Logout(false); SetLoggedIn(false); }
private static void StartMainForm() { try { do { Application.Run(new MainForm()); if (MainForm.Restart == true) { if (!ServiceHandler.CheckLogin()) { using (var loginForm = new LoginForm()) { if (loginForm.ShowDialog() != DialogResult.OK) { return; } //launcherSignInStatus = loginForm.LauncherSignInStatus; } } } } while (MainForm.Restart == true); } catch (Exception ex) { File.WriteAllText("ExceptionLog.txt", ex.ToString()); throw; } finally { if (MainForm.LoggedIn) { SessionNegotiator.Logout(true); } SystemWatcher.Close(); AllegianceLoader.ExitAllegiance(); } }