Пример #1
0
        private async void NewLayoutButton_Click(object sender, RoutedEventArgs e)
        {
            Logger.LogTrace();

            if (_openedDialog != null)
            {
                // another dialog already opened
                return;
            }

            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();
        }
Пример #2
0
        protected override void Run()
        {
            string newLayoutName = null;
            var    dlg           = new NewLayoutDialog();

            try {
                if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok)
                {
                    newLayoutName = dlg.LayoutName;
                }
            } finally {
                dlg.Destroy();
            }
            if (newLayoutName != null)
            {
                IdeApp.Workbench.CurrentLayout = newLayoutName;
            }
        }