public bool Equals(Macro other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Name, Name) && Equals(other.MacroCommand, MacroCommand); }
private void AddMacroCommand_Click(object sender, EventArgs e) { var configureMacro = new ConfigureMacro(); configureMacro.ShowDialog(this); if (configureMacro.DialogResult == DialogResult.OK) { if (MacroManager.Macros.Exists(m => m.Name.Equals(configureMacro.MacroName.Text, StringComparison.CurrentCultureIgnoreCase))) { MessageBox.Show(string.Format("Macro with name {0} already exists", configureMacro.MacroName.Text)); } else { var newMacro = new Macro(configureMacro.MacroName.Text) { MacroCommand = configureMacro.MacroCommand.Text }; MacroManager.Macros.Add(newMacro); RefreshMacrosList(); } } }