private void StubForm_FormClosing(object sender, FormClosingEventArgs e) { FileWatch.CloseActiveTargets(false, false); int nbDirtyFiles = Vault.GetDirtyTargets().Count; if (nbDirtyFiles > 0) { var answer = MessageBox.Show($"There are still {nbDirtyFiles} dirty files, would you like to restore them?", "Warning: Quitting FileStub with Dirty Files", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); switch (answer) { case DialogResult.Cancel: e.Cancel = true; return; case DialogResult.Yes: FileWatch.RestoreDirty(); return; case DialogResult.No: default: return; } } }
private void BtnUnloadTarget_Click(object sender, EventArgs e) { if (!FileWatch.CloseActiveTargets(restoreTarget: false)) { return; } DisableTargetInterface(); }
private void BtnClearAllBackups_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to reset the vault?\n This will delete any remaining artifacts.", "WARNING", MessageBoxButtons.YesNo) == DialogResult.No) { return; } if (btnUnloadTarget.Visible) { BtnUnloadTarget_Click(sender, e); } FileWatch.CloseActiveTargets(); Vault.ResetVault(); lbTargets.Items.Clear(); MessageBox.Show("The vault was reset."); }