Esempio n. 1
0
 public void Refresh()
 {
     bindingEditor = new BindingEditor();
     filterEditor.UpdateStore(Settings?.Filters);
     toolEditor.UpdateStore(Settings?.Tools);
     outputModeEditor.Refresh();
 }
Esempio n. 2
0
        private Control ConstructMainControls()
        {
            var displayAreaGroup = ConstructDisplayArea();
            var tabletAreaGroup  = ConstructTabletArea();

            var outputModeSelector = ConstructOutputModeSelector();

            absoluteConfig = ConstructAreaConfig(displayAreaGroup, tabletAreaGroup);
            relativeConfig = new SensitivityEditor();
            nullConfig     = new Panel();

            outputConfig = new StackLayout
            {
                Padding = 5,
                Spacing = 5,
                Items   =
                {
                    new StackLayoutItem(absoluteConfig,     HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(relativeConfig,     HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(nullConfig,         HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(outputModeSelector, HorizontalAlignment.Left,    false)
                }
            };

            filterEditor = new PluginSettingStoreCollectionEditor <IFilter>(
                new WeakReference <PluginSettingStoreCollection>(App.Settings?.Filters, true),
                "Filter"
                );

            toolEditor = new PluginSettingStoreCollectionEditor <ITool>(
                new WeakReference <PluginSettingStoreCollection>(App.Settings?.Tools, true),
                "Tool"
                );

            interpolatorEditor = new PluginSettingStoreCollectionEditor <Interpolator>(
                new WeakReference <PluginSettingStoreCollection>(App.Settings?.Interpolators),
                "Interpolator"
                );

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

            // Main Content
            var tabControl = new TabControl
            {
                Pages =
                {
                    new TabPage
                    {
                        Text    = "Output",
                        Content = outputConfig
                    },
                    new TabPage
                    {
                        Text    = "Bindings",
                        Content = new BindingEditor()
                    },
                    new TabPage
                    {
                        Text    = "Filters",
                        Padding = 5,
                        Content = filterEditor
                    },
                    new TabPage
                    {
                        Text    = "Tools",
                        Padding = 5,
                        Content = toolEditor
                    },
                    new TabPage
                    {
                        Text    = "Interpolators",
                        Padding = 5,
                        Content = interpolatorEditor
                    },
                    new TabPage
                    {
                        Text    = "Console",
                        Padding = 5,
                        Content = new LogView()
                    }
                }
            };

            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"
                    }
                }
            };

            return(new StackLayout
            {
                Items =
                {
                    new StackLayoutItem(tabControl,    HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(commandsPanel, HorizontalAlignment.Right)
                }
            });
        }
Esempio n. 3
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)
                }
            });
        }