private void LockVault(bool explictLock) { lbPasswordList.ItemsSource = null; lbPasswordList.Items.Clear(); lbPasswordList.Background = SystemColors.ControlBrush; txtAccount.Text = string.Empty; txtURL.Text = string.Empty; txtLogin.Text = string.Empty; ItemDetails.Clear(); if (explictLock) { _mgr.vault_lock(); } btnEditAccount.IsEnabled = false; btnViewPassword.IsEnabled = false; btnCopyPassword.IsEnabled = false; mnCopyto.IsEnabled = false; btnCreateVault.IsEnabled = true; btnOpenVault.IsEnabled = true; mnOpen.IsEnabled = true; mnNew.IsEnabled = true; _bCreateNewVault = false; btnlock.IsEnabled = false; mnLock.IsEnabled = false; btnUnlock.IsEnabled = true; pmangerPanel.Visibility = Visibility.Visible; txtpasswordbox.Clear(); txtpasswordbox.Focus(); _txtBlock.Text = "Enter your Master Password to Unlock your Vault "; btnUnlock.Content = "UnLock"; mnChangePassword.IsEnabled = false; }
public void Restore() { String path = working_vault; mgr.vault_lock(); if (path.Length > 0) { String orig = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "_orig.vlt"); String mod = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "_modified.vlt"); output(String.Format("Copying modified vault to {0}", mod)); output(String.Format("Restoring original vault file from {0} to {1}", orig, path)); try { File.Copy(path, mod, true); File.Copy(orig, path, true); } catch { } working_vault = ""; } }