private static bool InitShutdownSequence() { if (ShutdownSequenceInitialized) { return false; } ShutdownSequenceInitialized = true; WCF.StopServer(); foreach (Bot bot in Bot.Bots.Values) { bot.Stop(); } return true; }
private async void MainForm_FormClosed(object sender, FormClosedEventArgs e) => await Program.InitShutdownSequence().ConfigureAwait(false);