Exemplo n.º 1
0
        private Control ConstructMainControls()
        {
            // Main Content
            var tabControl = new TabControl
            {
                Pages =
                {
                    new TabPage
                    {
                        Text    = "Output",
                        Content = outputModeEditor = new OutputModeEditor()
                    },
                    new TabPage
                    {
                        Text    = "Bindings",
                        Content = bindingEditor = new BindingEditor()
                    },
                    new TabPage
                    {
                        Text    = "Filters",
                        Padding = 5,
                        Content = filterEditor = new PluginSettingStoreCollectionEditor <IPositionedPipelineElement <IDeviceReport> >
                        {
                            FriendlyTypeName = "Filter"
                        }
                    },
                    new TabPage
                    {
                        Text    = "Tools",
                        Padding = 5,
                        Content = toolEditor = new PluginSettingStoreCollectionEditor <ITool>
                        {
                            FriendlyTypeName = "Tool"
                        }
                    },
                    new TabPage
                    {
                        Text    = "Console",
                        Padding = 5,
                        Content = new LogView()
                    }
                }
            };

            outputModeEditor.StoreBinding.BindDataContext <App>(a => a.Settings.OutputMode);
            bindingEditor.TipButtonStoreBinding.BindDataContext <App>(a => a.Settings.TipButton);
            bindingEditor.EraserButtonStoreBinding.BindDataContext <App>(a => a.Settings.EraserButton);
            bindingEditor.TipPressureValueBinding.BindDataContext <App>(a => a.Settings.TipActivationPressure);
            bindingEditor.EraserPressureValueBinding.BindDataContext <App>(a => a.Settings.EraserActivationPressure);
            bindingEditor.PenButtonItemSourceBinding.BindDataContext <App>(a => a.Settings.PenButtons);
            bindingEditor.AuxiliaryButtonItemSourceBinding.BindDataContext <App>(a => a.Settings.AuxButtons);
            filterEditor.StoreCollectionBinding.BindDataContext <App>(a => a.Settings.Filters);
            toolEditor.StoreCollectionBinding.BindDataContext <App>(a => a.Settings.Tools);

            var commandsPanel = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                HorizontalContentAlignment = HorizontalAlignment.Right,
                Padding = new Padding(0, 5),
                Spacing = 5,
                Items   =
                {
                    new Button(async(s, e) => await SaveSettings(App.Current.Settings))
                    {
                        Text = "Save"
                    },
                    new Button(async(s, e) => await ApplySettings())
                    {
                        Text = "Apply"
                    }
                }
            };

            outputModeEditor.SetDisplaySize(DesktopInterop.VirtualScreen.Displays);

            return(new StackLayout
            {
                Items =
                {
                    new StackLayoutItem(tabControl,    HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(commandsPanel, HorizontalAlignment.Right)
                }
            });
        }
Exemplo n.º 2
0
        private Control ConstructMainControls()
        {
            // Main Content
            var tabControl = new TabControl
            {
                Pages =
                {
                    new TabPage
                    {
                        Text    = "Output",
                        Content = outputModeEditor = new OutputModeEditor()
                    },
                    new TabPage
                    {
                        Text    = "Bindings",
                        Content = bindingEditor = new BindingEditor()
                    },
                    new TabPage
                    {
                        Text    = "Filters",
                        Padding = 5,
                        Content = filterEditor = new PluginSettingStoreCollectionEditor <IFilter>(
                            Settings?.Filters,
                            "Filter"
                            )
                    },
                    new TabPage
                    {
                        Text    = "Tools",
                        Padding = 5,
                        Content = toolEditor = new PluginSettingStoreCollectionEditor <ITool>(
                            Settings?.Tools,
                            "Tool"
                            )
                    },
                    new TabPage
                    {
                        Text    = "Interpolators",
                        Padding = 5,
                        Content = interpolatorEditor = new PluginSettingStoreCollectionEditor <Interpolator>(
                            Settings?.Interpolators,
                            "Interpolator"
                            )
                    },
                    new TabPage
                    {
                        Text    = "Console",
                        Padding = 5,
                        Content = new LogView()
                    }
                }
            };

            SettingsChanged += (settings) =>
            {
                filterEditor.UpdateStore(Settings?.Filters);
                toolEditor.UpdateStore(Settings?.Tools);
                interpolatorEditor.UpdateStore(Settings?.Interpolators);
            };

            var commandsPanel = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                HorizontalContentAlignment = HorizontalAlignment.Right,
                Padding = new Padding(0, 5),
                Spacing = 5,
                Items   =
                {
                    new Button(async(s, e) => await SaveSettings(Settings))
                    {
                        Text = "Save"
                    },
                    new Button(async(s, e) => await ApplySettings())
                    {
                        Text = "Apply"
                    }
                }
            };

            outputModeEditor.SetDisplaySize(SystemInterop.VirtualScreen.Displays);

            return(new StackLayout
            {
                Items =
                {
                    new StackLayoutItem(tabControl,    HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(commandsPanel, HorizontalAlignment.Right)
                }
            });
        }