private void UI_CoreForm_FormClosing(object sender, FormClosingEventArgs e) { if (S.GET <RTC_StockpileManager_Form>().UnsavedEdits&& !UICore.isClosing && MessageBox.Show("You have unsaved edits in the Glitch Harvester Stockpile. \n\n Are you sure you want to close RTC without saving?", "Unsaved edits in Stockpile", MessageBoxButtons.YesNo) == DialogResult.No) { e.Cancel = true; return; } LocalNetCoreRouter.Route(NetcoreCommands.VANGUARD, NetcoreCommands.REMOTE_EVENT_CLOSEEMULATOR); //Sleep to make sure the message is sent System.Threading.Thread.Sleep(500); UICore.CloseAllRtcForms(); }