mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
FastFlag editor: prevent duplicate additions
This commit is contained in:
parent
e2c1997b21
commit
3c365a5839
@ -32,7 +32,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</ui:Button.Style>
|
</ui:Button.Style>
|
||||||
</ui:Button>
|
</ui:Button>
|
||||||
<ToggleButton Content="Show preset flags" Click="ToggleButton_Click" Margin="12,0,0,0" />
|
<ToggleButton x:Name="TogglePresetsButton" Content="Show preset flags" Click="ToggleButton_Click" Margin="12,0,0,0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<DataGrid Name="DataGrid" Grid.Row="2" HeadersVisibility="Column" GridLinesVisibility="Horizontal" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CellEditEnding="DataGrid_CellEditEnding">
|
<DataGrid Name="DataGrid" Grid.Row="2" HeadersVisibility="Column" GridLinesVisibility="Horizontal" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CellEditEnding="DataGrid_CellEditEnding">
|
||||||
|
@ -126,19 +126,39 @@ namespace Bloxstrap.UI.Elements.Menu.Pages
|
|||||||
if (dialog.Result != MessageBoxResult.OK)
|
if (dialog.Result != MessageBoxResult.OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var entry = new FastFlag
|
string name = dialog.FlagNameTextBox.Text;
|
||||||
{
|
|
||||||
// Enabled = true,
|
|
||||||
Name = dialog.FlagNameTextBox.Text,
|
|
||||||
Value = dialog.FlagValueTextBox.Text
|
|
||||||
};
|
|
||||||
|
|
||||||
_fastFlagList.Add(entry);
|
FastFlag? entry;
|
||||||
|
|
||||||
|
if (App.FastFlags.GetValue(name) is null)
|
||||||
|
{
|
||||||
|
entry = new FastFlag
|
||||||
|
{
|
||||||
|
// Enabled = true,
|
||||||
|
Name = dialog.FlagNameTextBox.Text,
|
||||||
|
Value = dialog.FlagValueTextBox.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
_fastFlagList.Add(entry);
|
||||||
|
|
||||||
|
App.FastFlags.SetValue(entry.Name, entry.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Controls.ShowMessageBox("An entry for this FastFlag already exists.", MessageBoxImage.Information);
|
||||||
|
|
||||||
|
if (!_showPresets && FastFlagManager.PresetFlags.Values.Contains(dialog.FlagNameTextBox.Text))
|
||||||
|
{
|
||||||
|
_showPresets = true;
|
||||||
|
TogglePresetsButton.IsChecked = true;
|
||||||
|
ReloadList();
|
||||||
|
}
|
||||||
|
|
||||||
|
entry = _fastFlagList.Where(x => x.Name == name).FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
DataGrid.SelectedItem = entry;
|
DataGrid.SelectedItem = entry;
|
||||||
DataGrid.ScrollIntoView(entry);
|
DataGrid.ScrollIntoView(entry);
|
||||||
|
|
||||||
App.FastFlags.SetValue(entry.Name, entry.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user