/*=====================================================*\ | Clear Clipboard | \*=====================================================*/ private void ClearClipboardTimer_Tick(object sender, EventArgs e) { if (Clipboard.GetText() == lastCopiedPassword) { Clipboard.Clear(); ClearClipboardTimer.Stop(); } lastCopiedPassword = ""; }
protected void button_Click(object sender, EventArgs e, int index) { Button button = (sender as Button); if (button.Text == "URL") { var url = Encrypter.Decrypt(accountData[index].Value[0], encryptionKey); if (url != "") { if (!url.StartsWith("https://", StringComparison.OrdinalIgnoreCase) && !url.StartsWith("http://", StringComparison.OrdinalIgnoreCase)) { url = "https://" + url; } ProcessStartInfo processInfo = new ProcessStartInfo(url); Process.Start(processInfo); } } else if (button.Text == "Account") { if (Encrypter.Decrypt(accountData[index].Value[1], encryptionKey) != "") { Clipboard.SetText(Encrypter.Decrypt(accountData[index].Value[1], encryptionKey)); } } else if (button.Text == "Password") { if (Encrypter.Decrypt(accountData[index].Value[2], encryptionKey) != "") { lastCopiedPassword = Encrypter.Decrypt(accountData[index].Value[2], encryptionKey); Clipboard.SetText(lastCopiedPassword); ClearClipboardTimer.Stop(); ClearClipboardTimer.Start(); } } else if (button.Text == "Delete") { deletedItemIndex = index; AddAccountButton.Enabled = false; SettingsButton.Enabled = false; LogoutButton.Enabled = false; ConfirmDeleteLabel.Text = "Are you sure you wish to delete account: " + Encrypter.Decrypt(accountData[deletedItemIndex].Key, encryptionKey) + "?"; ConfirmDeletePanel.Visible = true; } else if (button.Text == "Edit") { AccountsPanel.Visible = false; AddAccountButton.Enabled = false; SettingsButton.Enabled = false; LogoutButton.Enabled = false; ConfirmDeletePanel.Visible = false; EditAccountPanel.Visible = true; EditAccountTitleInput.Text = Encrypter.Decrypt(accountData[index].Key, encryptionKey); EditAccountURLInput.Text = Encrypter.Decrypt(accountData[index].Value[0], encryptionKey); EditAccountNameInput.Text = Encrypter.Decrypt(accountData[index].Value[1], encryptionKey); EditAccountPasswordInput.Text = Encrypter.Decrypt(accountData[index].Value[2], encryptionKey); EditAccountNotesInput.Text = Encrypter.Decrypt(accountData[index].Value[3], encryptionKey); EditAccountTitleInput.ForeColor = Color.White; EditAccountURLInput.ForeColor = Color.White; EditAccountNameInput.ForeColor = Color.White; EditAccountPasswordInput.ForeColor = Color.White; EditAccountNotesInput.ForeColor = Color.White; ResetEditAccountUI(); editingIndex = index; } }