Skip to content

Commit

Permalink
Added default custom layout name (#9291)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeraphimaZykova committed Jan 27, 2021
1 parent 1680b00 commit 37b6876
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,7 @@ To merge zones, select the zones and click "merge".</value>
<data name="Create_Custom_From_Template" xml:space="preserve">
<value>Create custom layout</value>
</data>
<data name="Default_Custom_Layout_Name" xml:space="preserve">
<value>Custom layout</value>
</data>
</root>

0 comments on commit 37b6876

Please sign in to comment.