diff --git a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml index f66edba0..d2447c8d 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml +++ b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml @@ -17,7 +17,7 @@ - + @@ -87,7 +87,7 @@ - + diff --git a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs index 8b88fdf3..01d37b6c 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs +++ b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs @@ -8,6 +8,7 @@ using Wpf.Ui.Mvvm.Contracts; using Bloxstrap.UI.Elements.Dialogs; +using System.Xml.Linq; namespace Bloxstrap.UI.Elements.Menu.Pages { @@ -111,11 +112,28 @@ private void DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventA break; */ case "Name": - string newName = ((TextBox)e.EditingElement).Text; + var textbox = e.EditingElement as TextBox; - App.FastFlags.SetValue(entry.Name, null); + string oldName = entry.Name; + string newName = textbox!.Text; + + if (newName == oldName) + return; + + if (App.FastFlags.GetValue(newName) is not null) + { + Controls.ShowMessageBox("A FastFlag with this name already exists.", MessageBoxImage.Information); + e.Cancel = true; + textbox.Text = oldName; + return; + } + + App.FastFlags.SetValue(oldName, null); App.FastFlags.SetValue(newName, entry.Value); + if (!newName.Contains(_searchFilter)) + ClearSearch(); + break; case "Value":