public void DeleteLayer() { if (_currentKeymapLayer == null) { MessageBox.Show("You must select a layer in order to delete it."); return; } var menuItem = AvailableLayersMenu.First(x => (string)x.Header == _currentKeymapLayer.LayerName); AvailableLayersMenu.Remove(menuItem); _keymapLayers.Remove(_currentKeymapLayer); _currentKeymapLayer = null; CurrentLayerName = string.Empty; }
private void RenameLayer(string layerName) { if (_currentKeymapLayer == null) { MessageBox.Show("You must select a layer in order to rename it."); return; } if (AvailableLayersMenu.Any(x => (string)x.Header == layerName)) { MessageBox.Show(string.Format("A layer with the name '{0}' already exists.", layerName)); return; } AvailableLayersMenu.First(x => (string)x.Header == _currentKeymapLayer.LayerName).Header = layerName; _currentKeymapLayer.LayerName = layerName; CurrentLayerName = layerName; }