private void Action(string tag) { switch (tag) { case "ADD": using (NewPasswordForm npf = new NewPasswordForm(_pwds, string.Empty)) { if (npf.ShowDialog().Equals(DialogResult.OK)) { _pwds.Add(npf.Credential); InitializePasswords(); } } break; case "REMOVE": if (!string.IsNullOrEmpty(_selectedId)) { if (MessageBox.Show(Messages.REMOVE, "Remove Credential", MessageBoxButtons.YesNo, MessageBoxIcon.Warning).Equals(DialogResult.Yes)) { _pwds.Delete(_selectedId); InitializePasswords(); } } break; case "EDIT": if (!string.IsNullOrEmpty(_selectedId)) { using (NewPasswordForm npf = new NewPasswordForm(_pwds, _selectedId)) { if (npf.ShowDialog().Equals(DialogResult.OK)) { _pwds.Update(npf.Credential, _selectedId); InitializePasswords(); } } } break; case "CLEAR": if (MessageBox.Show(Messages.CLEAR, "Clear Credentials", MessageBoxButtons.YesNo, MessageBoxIcon.Warning).Equals(DialogResult.Yes)) { _pwds.ClearAll(); InitializePasswords(); } break; case "COPY": Clipboard.SetText(string.Format("{0}\t{1}", lblUsername.Text, lblPassword.Text)); break; case "COPY_USER": Clipboard.SetText(lblUsername.Text); break; case "COPY_PWD": Clipboard.SetText(lblPassword.Text); break; case "RELOAD": InitializePasswords(); break; case "SETTINGS": using (OptionForm opt = new OptionForm()) { opt.ShowDialog(); InitializeSettings(); InitializePasswords(); } break; case "HELP": using (HelpForm h = new HelpForm()) { h.ShowDialog(); } break; case "EXIT": Close(); break; case "ABOUT": using (AboutForm a = new AboutForm()) { a.ShowDialog(); } break; case "HIDEPWD": if (_hidePassword) { if (MessageBox.Show(Messages.SHOW, "Show Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes)) { RegConfig.Set <bool>("HidePassword", menuHidePwd.Checked); _hidePassword = menuHidePwd.Checked; } } else { RegConfig.Set <bool>("HidePassword", menuHidePwd.Checked); _hidePassword = menuHidePwd.Checked; } InitializePasswords(); break; case "TOOLBAR": RegConfig.Set <bool>("Toolbar", menuToolbar.Checked); toolStripPwd.Visible = menuToolbar.Checked; break; case "STATUS": RegConfig.Set <bool>("Statusbar", menuStatus.Checked); statusStripPwd.Visible = menuStatus.Checked; break; case "XPLOOK": RegConfig.Set <bool>("XPLook", menuXPLook.Checked); Application.Restart(); break; default: break; } }