/// <summary> /// Opens archive form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void archive_btn_Click(object sender, EventArgs e) { if (archiveForm == null) { archiveForm = new ArchiveForm(); archiveForm.FormClosing += (o, form) => { Show(); archiveForm = null; }; Hide(); archiveForm.ItemDeleted += new EventHandler((_sender, _e) => HandleItemDeleted(_sender, _e)); archiveForm.ItemSelected += new EventHandler((_sender, _e) => HandleItemSelected(_sender, _e)); archiveForm.Show(); } else { archiveForm.Focus(); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; if (autobackup != null) { autobackup.Dispose(); } if (archiveForm != null) { archiveForm = null; } if (optionsForm != null) { optionsForm = null; } if (thrd != null) { thrd = null; } programData = null; e.Cancel = false; }