public static void GroupClosed(bool faulted = false) { if (CurrentGroup == null) { Log.LogInfo("Trying to close group when it's null"); return; } Log.LogInfo("Disconnect from group. Faulted: " + faulted); try { ViewerController.OnAppClosing(); clientConnection.Disconnect(); CurrentGroup = null; role = Role.Notconnected; formMenu.RestoreWindow(); FormAlert formAlert; if (faulted) { formAlert = new FormAlert("Connection faulted", "Probably host lost network connection", true); } else { formAlert = new FormAlert("Group was closed", "Host closed the group", true); } int overlay = Helper.ShowOverlay(); formAlert.ShowDialog(); Helper.HideOverlay(overlay); ChatController.CleanChat(); } catch (Exception e) { Log.LogException(e, "Error during GroupClosed"); } }
private void Disconnect(bool force = false) { if (Connection.CurrentRole == Role.Host) { int overlay = Helper.ShowOverlay(this); FormAlert formAlert = new FormAlert("Confirmation", "Close the group?"); if (force || formAlert.ShowDialog() == DialogResult.OK) { Helper.HideOverlay(overlay); ServerController.OnGroupClose(); PresentationController.OnAppClosing(); ViewerController.OnAppClosing(); Connection.Disconnect(); LoadConnectionTab(); buttonJoin.Enabled = true; } Helper.HideOverlay(overlay); } else if (Connection.CurrentRole == Role.Client) { int overlay = Helper.ShowOverlay(this); FormAlert formAlert = new FormAlert("Confirmation", "Disconnect from the group?"); if (force || formAlert.ShowDialog() == DialogResult.OK) { Helper.HideOverlay(overlay); ViewerController.OnAppClosing(); PresentationController.OnAppClosing(); Connection.Disconnect(); LoadConnectionTab(); buttonJoin.Enabled = true; } Helper.HideOverlay(overlay); } }
public static void UserBanned() { if (CurrentGroup == null) { Log.LogInfo("Trying to close group after ban when it's null"); return; } Log.LogInfo("Banned from the group."); try { ViewerController.OnAppClosing(); clientConnection.Disconnect(); CurrentGroup = null; role = Role.Notconnected; formMenu.RestoreWindow(); FormAlert formAlert = new FormAlert("Ban", "You was banned from the group", true); int overlay = Helper.ShowOverlay(); formAlert.ShowDialog(); Helper.HideOverlay(overlay); ChatController.CleanChat(); } catch (Exception e) { Log.LogException(e, "Error during UserBanned"); } }
private void OnAppClosing() { if (Connection.CurrentRole == Role.Host) { ServerController.OnGroupClose(); PresentationController.OnAppClosing(); } else if (Connection.CurrentRole == Role.Client) { ViewerController.OnAppClosing(); Connection.Disconnect(); } CleanTempFiles(); }