public bool Close() { if (Receiver.CanStop()) { Stop(); } if (Dirty) { switch (MessageBox.Show(TabPanel, "Session '" + Name + "' has unsaved changes. Save before exit?", "NLogViewer", MessageBoxButtons.YesNoCancel)) { case DialogResult.Yes: if (!Save(TabPanel)) { return(false); } break; case DialogResult.Cancel: return(false); } } _mainForm.RemoveSession(this); return(true); }