private void SaveButton_Click(object sender, EventArgs e) { if (KeyNameTextBox.Text != string.Empty) { key.KeyName = KeyNameTextBox.Text; } else { key.KeyName = RSAEncryptor.ValidateKeyName("Chave"); } key.encryptionMode = (Key.EncryptionMode)EncryptionModeDropdown.SelectedItem; if (key.encryptionMode == Key.EncryptionMode.Automatic) { SaveAutomaticKey(); } else { SaveManualKey(); } KeysTab.UpdateKeysList(); RSAEncryptor.UpdateKeysList(); }
public RSAEncryptor() { InitializeComponent(); instance = this; keys.AllowEdit = true; keys.RaiseListChangedEvents = true; }
private void AddKeyButton_Click(object sender, EventArgs e) { string newKeyName = RSAEncryptor.ValidateKeyName("Nova Chave"); var key = new Key(); key.SetName(newKeyName); RSAEncryptor.AddKey(key); AddKey(newKeyName); KeysList.CurrentCell = KeysList.Rows[KeysList.Rows.Count - 1].Cells[0]; UpdateItemsSize(); }
private void KeysList_CellContentClick(object sender, DataGridViewCellEventArgs e) { var grid = sender as DataGridView; if (grid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { if (e.ColumnIndex == 1) { RSAEncryptor.OpenKeyEdit(true, RSAEncryptor.keys[e.RowIndex]); } else if (e.ColumnIndex == 2) { RSAEncryptor.RemoveKey(e.RowIndex); grid.Rows.RemoveAt(e.RowIndex); KeysList.ClearSelection(); UpdateItemsSize(); } } }
private void UpdateItemsSize() { for (int i = 0; i < KeysList.Rows.Count; i++) { var row = KeysList.Rows[i]; row.Height = (int)(KeysList.Size.Height * 0.125f); } for (int i = 0; i < KeysList.Columns.Count; i++) { var column = KeysList.Columns[i]; column.DefaultCellStyle.Font = new Font("Arial", RSAEncryptor.GetDynamicFontSize(15), FontStyle.Regular); bool isScrollbarVisible = false; foreach (var scroll in KeysList.Controls.OfType <VScrollBar>()) { if (scroll.Visible) { isScrollbarVisible = true; break; } } int scrollWidth = isScrollbarVisible ? SystemInformation.VerticalScrollBarWidth : 0; if (i == 0) { column.Width = (int)((KeysList.Size.Width - scrollWidth) * 0.6f); } else { column.Width = (int)((KeysList.Size.Width - scrollWidth) * 0.2f); } } }
private void ResizeTexts() { RSAEncryptor.ResizeTexts(15, KeyInfoLayout); RSAEncryptor.ResizeText(25, KeyName); }
private void EditButton_Click(object sender, EventArgs e) { RSAEncryptor.OpenKeyEdit(true, key); }
private void ResizeTexts() { RSAEncryptor.ResizeTexts(15, EncryptorLayout, EncryptionPanel, DecryptionPanel); RSAEncryptor.ResizeText(25, EncryptionKeysDropdown); RSAEncryptor.ResizeText(25, DecryptionKeysDropdown); }
private void ResizeTexts() { RSAEncryptor.ResizeTexts(14, EditLayout, KeysLayout, PublicKeyValidationPanel, PrivateKeyValidationPanel); }
private void ResizeTexts() { RSAEncryptor.ResizeTexts(15, KeyEditTabLayout, AutoEditLayout, PublicKeyValidationPanel, PrivateKeyValidationPanel); RSAEncryptor.ResizeText(25, EncryptionModeDropdown); }
private void BackButton_Click(object sender, EventArgs e) { EditPanel.Controls.Remove(manualKeyEditor); RSAEncryptor.OpenKeyEdit(false); }
private void ResizeTexts() { RSAEncryptor.ResizeTexts(15, KeysTabLayout); }
private void SaveChangesButton_Click(object sender, EventArgs e) { RSAEncryptor.SaveKeysData(); }
private void RevertButton_Click(object sender, EventArgs e) { RSAEncryptor.LoadKeysData(); UpdateKeysList(); }
private void RemoveAllButton_Click(object sender, EventArgs e) { RSAEncryptor.RemoveAllKeys(); KeysList.Rows.Clear(); }