コード例 #1
0
        private async void DeleteLayout(FrameworkElement element)
        {
            var dialog = new ModernWpf.Controls.ContentDialog()
            {
                Title               = FancyZonesEditor.Properties.Resources.Are_You_Sure,
                Content             = FancyZonesEditor.Properties.Resources.Are_You_Sure_Description,
                PrimaryButtonText   = FancyZonesEditor.Properties.Resources.Delete,
                SecondaryButtonText = FancyZonesEditor.Properties.Resources.Cancel,
            };

            var result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                LayoutModel model = element.DataContext as LayoutModel;

                if (model == _settings.AppliedModel)
                {
                    _settings.SetAppliedModel(_settings.BlankModel);
                    Select(_settings.BlankModel);
                }

                foreach (var monitor in App.Overlay.Monitors)
                {
                    if (monitor.Settings.ZonesetUuid == model.Uuid)
                    {
                        App.Overlay.SetLayoutSettings(monitor, _settings.BlankModel);
                    }
                }

                App.FancyZonesEditorIO.SerializeZoneSettings();
                model.Delete();
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: winux10/PowerToys
        private void NewLayoutDialog_PrimaryButtonClick(ModernWpf.Controls.ContentDialog sender, ModernWpf.Controls.ContentDialogButtonClickEventArgs args)
        {
            LayoutModel selectedLayoutModel;

            if (GridLayoutRadioButton.IsChecked == true)
            {
                GridLayoutModel gridModel = new GridLayoutModel(LayoutNameText.Text, LayoutType.Custom)
                {
                    Rows        = 1,
                    RowPercents = new List <int>(1)
                    {
                        GridLayoutModel.GridMultiplier
                    },
                };
                selectedLayoutModel = gridModel;
            }
            else
            {
                selectedLayoutModel = new CanvasLayoutModel(LayoutNameText.Text, LayoutType.Custom)
                {
                    TemplateZoneCount = 0,
                };
            }

            selectedLayoutModel.InitTemplateZones();

            App.Overlay.CurrentDataContext = selectedLayoutModel;
            var mainEditor = App.Overlay;

            Hide();
            mainEditor.OpenEditor(selectedLayoutModel);
        }
コード例 #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 16 "..\..\MainWindow.xaml"
                ((DGP.DecompilerMC.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.VersionList = ((ModernWpf.Controls.ListView)(target));
                return;

            case 3:

            #line 66 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ClearButton_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 70 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DecompileButton_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.InfoDialog = ((ModernWpf.Controls.ContentDialog)(target));
                return;

            case 6:
                this.ProcessDialog = ((System.Windows.Controls.Grid)(target));
                return;

            case 7:
                this.DialogTitle = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.Progress = ((System.Windows.Controls.ProgressBar)(target));
                return;

            case 9:
                this.DialogInfoText = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
コード例 #4
0
        private void NewLayoutDialog_PrimaryButtonClick(ModernWpf.Controls.ContentDialog sender, ModernWpf.Controls.ContentDialogButtonClickEventArgs args)
        {
            Logger.LogTrace();

            LayoutModel selectedLayoutModel;

            if (GridLayoutRadioButton.IsChecked == true)
            {
                GridLayoutModel gridModel = new GridLayoutModel(LayoutNameText.Text, LayoutType.Custom)
                {
                    Rows        = 1,
                    RowPercents = new List <int>(1)
                    {
                        GridLayoutModel.GridMultiplier
                    },
                };
                selectedLayoutModel = gridModel;
            }
            else
            {
                var area = App.Overlay.WorkArea;
                CanvasLayoutModel canvasModel = new CanvasLayoutModel(LayoutNameText.Text, LayoutType.Custom, (int)area.Width, (int)area.Height);
                canvasModel.AddZone();
                selectedLayoutModel = canvasModel;
            }

            selectedLayoutModel.InitTemplateZones();

            try
            {
                Hide();
            }
            catch
            {
                // See https://github.com/microsoft/PowerToys/issues/9396
                Hide();
            }

            App.Overlay.CurrentDataContext = selectedLayoutModel;
            App.Overlay.OpenEditor(selectedLayoutModel);
        }