private void btnAddMap_Click( object sender, EventArgs e ) { if ( _dlgAdd.ShowDialog() != DialogResult.OK ) return; var k = new Map { Key = (Keys) _dlgAdd.cmbKey.SelectedItem, Path = _dlgAdd.txtPath.Text }; if ( !_core.AddMap( k ) ) { MessageBox.Show( "Failed to add map", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } RefreshKeymaps(); }
public bool AddMap( Map map ) { if (!_maps.ContainsKey( map.Key )) _maps.Add( map.Key, map ); return true; }