diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs index b50bb96962d4..1a80fc8816c7 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs @@ -129,7 +129,24 @@ private void Select(LayoutModel newSelection) private async void NewLayoutButton_Click(object sender, RoutedEventArgs e) { - LayoutNameText.Text = string.Empty; + string defaultNamePrefix = FancyZonesEditor.Properties.Resources.Default_Custom_Layout_Name; + int maxCustomIndex = 0; + foreach (LayoutModel customModel in MainWindowSettingsModel.CustomModels) + { + string name = customModel.Name; + if (name.StartsWith(defaultNamePrefix)) + { + if (int.TryParse(name.Substring(defaultNamePrefix.Length), out int i)) + { + if (maxCustomIndex < i) + { + maxCustomIndex = i; + } + } + } + } + + LayoutNameText.Text = defaultNamePrefix + " " + (++maxCustomIndex); GridLayoutRadioButton.IsChecked = true; GridLayoutRadioButton.Focus(); await NewLayoutDialog.ShowAsync(); diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs index 3065f6cd86b9..161d9db94e44 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.Designer.cs @@ -222,6 +222,15 @@ public static string Custom_Layout_Creator { } } + /// + /// Looks up a localized string similar to Custom layout. + /// + public static string Default_Custom_Layout_Name { + get { + return ResourceManager.GetString("Default_Custom_Layout_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Delete. /// diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx index bff67c7b43a4..bd45e1ca4b5d 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx +++ b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/Resources.resx @@ -331,4 +331,7 @@ To merge zones, select the zones and click "merge". Create custom layout + + Custom layout + \ No newline at end of file