void RemoveKey(string key) { bool done = false; foreach (DataGridViewRow row in dataGridView_CdKey.Rows) { if (!row.IsNewRow && key.Equals(row.Cells[RealKey.Name].Value.ToString())) { done = true; if (MessageBoxExInt.ShowQuestion(this, FormString.RemoveKey_Question) != DialogResult.OK) { return; } dataGridView_CdKey.Rows.Remove(row); break; } } if (!done) { MessageBoxExInt.ShowExclamation(this, FormString.RemoveKey_NotFound); return; } CdKeyList_Adjust(); Sound.Asterisk(); }
void SaveKey(string key) { ErrorState error = CdKey.Key.IsValidAsErrorState(key); if (ErrorHandler.Handle(this, error)) { return; } string formatKey = SecureString.Mask(key, GlobalSettings.Default.MaskList); foreach (DataGridViewRow row in dataGridView_CdKey.Rows) { if (!row.IsNewRow && key.Equals(row.Cells[RealKey.Name].Value.ToString())) { MessageBoxExInt.ShowExclamation(this, FormString.SaveKey_DuplicateFound); return; } } if (MessageBoxExInt.ShowQuestion(this, FormString.SaveKey_Question) != DialogResult.OK) { return; } dataGridView_CdKey.Rows.Add(formatKey, key); CdKeyList_Adjust(); Sound.Asterisk(); }