protected override void OnFormClosing(FormClosingEventArgs e) { DialogResult result = MessageDialogs.CloseForm(e); if (result == DialogResult.Yes) { service.CloseQueueFile(); } e.Cancel = (result == DialogResult.No); }