private void dbMenuItem_Select(object sender, EventArgs e) { DialogManager.SetMenuItemProperty(closeDBMenuItem, _mListView != null); DialogManager.SetMenuItemProperty(importDatabaseMenuItem, _mListView != null); DialogManager.SetMenuItemProperty(exportDatabaseMenuItem, _mListView != null); DialogManager.SetMenuItemProperty(saveDBMenuItem, _mListView != null); DialogManager.SetMenuItemProperty(saveAsDBMenuItem, _mListView != null); }
private void ReEnableMenuItems() { DialogManager.SetMenuItemProperty(addEntryMenuItem, true); DialogManager.SetMenuItemProperty(editViewEntryMenuItem, true); DialogManager.SetMenuItemProperty(delEntryMenuItem, true); DialogManager.SetMenuItemProperty(duplicateEntryMenuItem, true); DialogManager.SetMenuItemProperty(cpUsernameMenuItem, true); DialogManager.SetMenuItemProperty(cpPasswordMenuItem, true); DialogManager.SetMenuItemProperty(openURLMenuItem, true); }
private void closeDBMenuItem_Click(object sender, EventArgs e) { if (_mListView == null || !Controls.Contains(_mListView.MLView)) { return; } DatabaseHandler.CloseDatabase(_mListView.MLView, this); DialogManager.SetMenuItemProperty(newDBMenuItem, true); _mDialog.MLabel.Visible = true; _mListView = null; Text = "Enigma-Pro"; _mSDatabaseFilePath = ""; }
private void newDBMenuItem_Click(object sender, EventArgs e) { _mMasterKeyDlg = new DialogManager(); _mMasterKeyDlg?.InitializeSetKeyFile(); if (!DialogManager.MKeySet) { return; } _mListView = new DialogManager(); DatabaseHandler.NewDatabase(_mListView, this); _mDialog.MLabel.Visible = false; ReEnableMenuItems(); DialogManager.SetMenuItemProperty(newDBMenuItem, false); }
private void entriesMenuItem_Select(object sender, EventArgs e) { if (_mListView != null) { if (_mListView.MLView.SelectedItems.Count == 1) { DialogManager.SetMenuItemProperty(editViewEntryMenuItem, true); DialogManager.SetMenuItemProperty(delEntryMenuItem, true); DialogManager.SetMenuItemProperty(duplicateEntryMenuItem, true); DialogManager.SetMenuItemProperty(cpUsernameMenuItem, true); DialogManager.SetMenuItemProperty(cpPasswordMenuItem, true); DialogManager.SetMenuItemProperty(openURLMenuItem, true); } else if (_mListView.MLView.SelectedItems.Count > 1) { DialogManager.SetMenuItemProperty(editViewEntryMenuItem, false); DialogManager.SetMenuItemProperty(duplicateEntryMenuItem, false); DialogManager.SetMenuItemProperty(cpUsernameMenuItem, false); DialogManager.SetMenuItemProperty(cpPasswordMenuItem, false); DialogManager.SetMenuItemProperty(openURLMenuItem, false); } else { DialogManager.SetMenuItemProperty(editViewEntryMenuItem, false); DialogManager.SetMenuItemProperty(delEntryMenuItem, false); DialogManager.SetMenuItemProperty(duplicateEntryMenuItem, false); DialogManager.SetMenuItemProperty(cpUsernameMenuItem, false); DialogManager.SetMenuItemProperty(cpPasswordMenuItem, false); DialogManager.SetMenuItemProperty(openURLMenuItem, false); } } else { DialogManager.SetMenuItemProperty(addEntryMenuItem, false); DialogManager.SetMenuItemProperty(editViewEntryMenuItem, false); DialogManager.SetMenuItemProperty(delEntryMenuItem, false); DialogManager.SetMenuItemProperty(duplicateEntryMenuItem, false); DialogManager.SetMenuItemProperty(cpUsernameMenuItem, false); DialogManager.SetMenuItemProperty(cpPasswordMenuItem, false); DialogManager.SetMenuItemProperty(openURLMenuItem, false); } }
private void openDBMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "Enigma DB-File (*.edb)|*.edb", Title = "Open Database File" }; if (openFileDialog.ShowDialog() == DialogResult.OK) { // If Database exists -> close current db if (_mListView != null && Controls.Contains(_mListView.MLView)) { DatabaseHandler.CloseDatabase(_mListView.MLView, this); DialogManager.SetMenuItemProperty(newDBMenuItem, true); _mDialog.MLabel.Visible = true; } _mMasterKeyDlg = new DialogManager(); _mMasterKeyDlg?.InitializeGetKeyFile(); if (!DialogManager.MKeyGet) { return; } _mListView = new DialogManager(); DatabaseHandler.OpenDatabase(_mListView, this, openFileDialog); _mDialog.MLabel.Visible = false; ReEnableMenuItems(); DialogManager.SetMenuItemProperty(newDBMenuItem, false); _mSDatabaseFilePath = Path.GetFullPath(openFileDialog.FileName); this.Text = $"{Path.GetFileName(openFileDialog.FileName)} - Enigma-Pro"; } }