public void ProcessCommandline()
        {
            var commandLineArgs = Environment.GetCommandLineArgs();

#if DEBUG
            WinformsEventSink.AllowInspector = true;
#endif

            for (int currentCommandIndex = 0; currentCommandIndex < commandLineArgs.Length; currentCommandIndex++)
            {
                string command = commandLineArgs[currentCommandIndex];
                switch (command.ToUpper())
                {
                case "FORCE_SOFTWARE_RENDERING":
                    RootSystemWindow.UseGl = false;
                    break;

                case "CLEAR_CACHE":
                    CacheDirectory.DeleteCacheData();
                    break;

                case "SHOW_MEMORY":
                    RootSystemWindow.ShowMemoryUsed = true;
                    break;

                case "ALLOW_INSPECTOR":
                    WinformsEventSink.AllowInspector = true;
                    break;
                }
            }
        }
Example #2
0
        public void ProcessCommandline()
        {
            var commandLineArgs = Environment.GetCommandLineArgs();

            for (int currentCommandIndex = 0; currentCommandIndex < commandLineArgs.Length; currentCommandIndex++)
            {
                string command      = commandLineArgs[currentCommandIndex];
                string commandUpper = command.ToUpper();
                switch (commandUpper)
                {
                case "FORCE_SOFTWARE_RENDERING":
                    GL.HardwareAvailable = false;
                    break;

                case "CLEAR_CACHE":
                    CacheDirectory.DeleteCacheData();
                    break;

                case "SHOW_MEMORY":
                    RootSystemWindow.ShowMemoryUsed = true;
                    break;
                }
            }
        }
Example #3
0
        public AboutPage()
            : base("Close".Localize())
        {
            this.WindowTitle = "About".Localize() + " " + ApplicationController.Instance.ProductName;

            var theme = ApplicationController.Instance.Theme;

            this.MinimumSize = new Vector2(480 * GuiWidget.DeviceScale, 520 * GuiWidget.DeviceScale);
            this.WindowSize  = new Vector2(500 * GuiWidget.DeviceScale, 550 * GuiWidget.DeviceScale);

            contentRow.BackgroundColor = Color.Transparent;

            headerRow.Visible = false;

            var altHeadingRow = new GuiWidget()
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Absolute,
                Height  = 100,
            };

            contentRow.AddChild(altHeadingRow);

            var productInfo = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                HAnchor = HAnchor.Center | HAnchor.Fit,
                VAnchor = VAnchor.Center | VAnchor.Fit
            };

            var productTitle = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.Center | HAnchor.Fit
            };

            productTitle.AddChild(new TextWidget("MatterControl".Localize(), textColor: theme.Colors.PrimaryTextColor, pointSize: 20)
            {
                Margin = new BorderDouble(right: 3)
            });
            productTitle.AddChild(new TextWidget("TM".Localize(), textColor: theme.Colors.PrimaryTextColor, pointSize: 7)
            {
                VAnchor = VAnchor.Top
            });

            altHeadingRow.AddChild(productInfo);
            productInfo.AddChild(productTitle);

            var spinnerPanel = new GuiWidget()
            {
                HAnchor = HAnchor.Absolute | HAnchor.Left,
                VAnchor = VAnchor.Absolute,
                Height  = 100,
                Width   = 100,
            };

            altHeadingRow.AddChild(spinnerPanel);
            var accentColor = theme.Colors.PrimaryAccentColor;

            var spinner = new LogoSpinner(spinnerPanel, 4, 0.2, 0, rotateX: 0)
            {
                /*
                 * MeshColor = new Color(175, 175, 175, 255),
                 * AmbientColor = new float[]
                 * {
                 *      accentColor.Red0To1,
                 *      accentColor.Green0To1,
                 *      accentColor.Blue0To1,
                 *      0
                 * }*/
            };

            productInfo.AddChild(
                new TextWidget("Version".Localize() + " " + VersionInfo.Instance.BuildVersion, textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize)
            {
                HAnchor = HAnchor.Center
            });

            productInfo.AddChild(
                new TextWidget("Developed By".Localize() + ": " + "MatterHackers", textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize)
            {
                HAnchor = HAnchor.Center
            });

            contentRow.AddChild(
                new WrappedTextWidget(
                    "MatterControl is made possible by the team at MatterHackers and other open source software".Localize() + ":",
                    pointSize: theme.DefaultFontSize,
                    textColor: theme.Colors.PrimaryTextColor)
            {
                HAnchor = HAnchor.Stretch,
                Margin  = new BorderDouble(0, 15)
            });

            var originalFontSize = theme.LinkButtonFactory.fontSize;

            theme.LinkButtonFactory.fontSize = theme.DefaultFontSize;

            var licensePanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Margin  = new BorderDouble(bottom: 15)
            };

            var data = JsonConvert.DeserializeObject <List <LibraryLicense> >(AggContext.StaticData.ReadAllText(Path.Combine("License", "license.json")));

            var linkIcon = AggContext.StaticData.LoadIcon("fa-link_16.png", 16, 16, theme.InvertIcons);

            foreach (var item in data.OrderBy(i => i.Name))
            {
                var linkButton = new IconButton(linkIcon, theme);
                linkButton.Click += (s, e) => UiThread.RunOnIdle(() =>
                {
                    ApplicationController.Instance.LaunchBrowser(item.Url);
                });

                var section = new SectionWidget(item.Title ?? item.Name, new LazyLicenseText(item.Name, theme), theme, linkButton, expanded: false)
                {
                    HAnchor = HAnchor.Stretch
                };
                licensePanel.AddChild(section);
            }

            var scrollable = new ScrollableWidget(autoScroll: true)
            {
                HAnchor     = HAnchor.Stretch,
                VAnchor     = VAnchor.Stretch,
                Margin      = new BorderDouble(bottom: 10),
                Border      = new BorderDouble(top: 1),
                BorderColor = new Color(theme.Colors.SecondaryTextColor, 50)
            };

            scrollable.ScrollArea.HAnchor = HAnchor.Stretch;
            scrollable.AddChild(licensePanel);
            contentRow.AddChild(scrollable);

            var feedbackButton = new TextButton("Send Feedback", theme)
            {
                BackgroundColor = theme.MinimalShade,
                HAnchor         = HAnchor.Absolute,
            };

            feedbackButton.Click += (s, e) => UiThread.RunOnIdle(() =>
            {
                this.DialogWindow.ChangeToPage <ContactFormPage>();
            });

            this.AddPageAction(feedbackButton, highlightFirstAction: false);

            var siteLink = theme.LinkButtonFactory.Generate("www.matterhackers.com");

            siteLink.HAnchor = HAnchor.Center;
            siteLink.Cursor  = Cursors.Hand;
            siteLink.Click  += (s, e) => UiThread.RunOnIdle(() =>
            {
                ApplicationController.Instance.LaunchBrowser("http://www.matterhackers.com");
            });
            contentRow.AddChild(siteLink);

            contentRow.AddChild(
                new TextWidget("Copyright © 2018 MatterHackers, Inc.", textColor: theme.Colors.PrimaryTextColor, pointSize: theme.DefaultFontSize)
            {
                HAnchor = HAnchor.Center,
            });

            var clearCacheLink = theme.LinkButtonFactory.Generate("Clear Cache".Localize());

            clearCacheLink.HAnchor = HAnchor.Center;
            clearCacheLink.Cursor  = Cursors.Hand;
            clearCacheLink.Click  += (s, e) => UiThread.RunOnIdle(() =>
            {
                CacheDirectory.DeleteCacheData();
            });
            contentRow.AddChild(clearCacheLink);

            theme.LinkButtonFactory.fontSize = originalFontSize;
        }
        private void AddAdvancedPannel(GuiWidget settingsColumn)
        {
            var advancedPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);

            var advancedSection = new SectionWidget("Advanced".Localize(), advancedPanel, theme, serializationKey: "ApplicationSettings-Advanced", expanded: false)
            {
                Name    = "Advanced Section",
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Margin  = 0
            };

            settingsColumn.AddChild(advancedSection);

            theme.ApplyBoxStyle(advancedSection);

            // Touch Screen Mode
            this.AddSettingsRow(
                new SettingsItem(
                    "Touch Screen Mode".Localize(),
                    theme,
                    new SettingsItem.ToggleSwitchConfig()
            {
                Checked      = UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode) == "touchscreen",
                ToggleAction = (itemChecked) =>
                {
                    string displayMode = itemChecked ? "touchscreen" : "responsive";
                    if (displayMode != UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode))
                    {
                        UserSettings.Instance.set(UserSettingsKey.ApplicationDisplayMode, displayMode);
                        UiThread.RunOnIdle(() => ApplicationController.Instance.ReloadAll().ConfigureAwait(false));
                    }
                }
            }),
                advancedPanel);

            AddUserBoolToggle(advancedPanel,
                              "Enable Socketeer Client".Localize(),
                              UserSettingsKey.ApplicationUseSocketeer,
                              true,
                              false);

            AddUserBoolToggle(advancedPanel,
                              "Utilize High Res Monitors".Localize(),
                              UserSettingsKey.ApplicationUseHeigResDisplays,
                              true,
                              false);

            var openCacheButton = new IconButton(StaticData.Instance.LoadIcon("fa-link_16.png", 16, 16).SetToColor(theme.TextColor), theme)
            {
                ToolTipText = "Open Folder".Localize(),
            };

            openCacheButton.Click += (s, e) => UiThread.RunOnIdle(() =>
            {
                Process.Start(ApplicationDataStorage.ApplicationUserDataPath);
            });

            this.AddSettingsRow(
                new SettingsItem(
                    "Application Storage".Localize(),
                    openCacheButton,
                    theme),
                advancedPanel);

            var clearCacheButton = new HoverIconButton(StaticData.Instance.LoadIcon("remove.png", 16, 16).SetToColor(theme.TextColor), theme)
            {
                ToolTipText = "Clear Cache".Localize(),
            };

            clearCacheButton.Click += (s, e) => UiThread.RunOnIdle(() =>
            {
                CacheDirectory.DeleteCacheData();
            });

            this.AddSettingsRow(
                new SettingsItem(
                    "Application Cache".Localize(),
                    clearCacheButton,
                    theme),
                advancedPanel);

#if DEBUG
            var configureIcon = StaticData.Instance.LoadIcon("fa-cog_16.png", 16, 16).SetToColor(theme.TextColor);

            var configurePluginsButton = new IconButton(configureIcon, theme)
            {
                ToolTipText = "Configure Plugins".Localize(),
                Margin      = 0
            };
            configurePluginsButton.Click += (s, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    DialogWindow.Show <PluginsPage>();
                });
            };

            this.AddSettingsRow(
                new SettingsItem(
                    "Plugins".Localize(),
                    configurePluginsButton,
                    theme),
                advancedPanel);
#endif

            var gitHubPat = UserSettings.Instance.get("GitHubPat");
            if (gitHubPat == null)
            {
                gitHubPat = "";
            }
            var accessToken = new MHTextEditWidget(gitHubPat, theme, pixelWidth: 350, messageWhenEmptyAndNotSelected: "Enter Person Access Token".Localize())
            {
                HAnchor = HAnchor.Absolute,
                Margin  = new BorderDouble(5),
                Name    = "GitHubPat Edit Field"
            };
            accessToken.ActualTextEditWidget.EnterPressed += (s, e) =>
            {
                UserSettings.Instance.set("GitHubPat", accessToken.ActualTextEditWidget.Text);
            };
            accessToken.Closed += (s, e) =>
            {
                UserSettings.Instance.set("GitHubPat", accessToken.ActualTextEditWidget.Text);
            };
            this.AddSettingsRow(
                new SettingsItem(
                    "GitHub Personal Access Token".Localize(),
                    accessToken,
                    theme)
            {
                ToolTipText = "This is used to increase the number of downloads allowed when browsing GitHub repositories".Localize(),
            },
                advancedPanel);

            advancedPanel.Children <SettingsItem>().First().Border = new BorderDouble(0, 1);
        }
Example #5
0
        public ApplicationSettingsPage()
        {
            this.AlwaysOnTopOfMain = true;
            this.WindowTitle       = this.HeaderText = "MatterControl " + "Settings".Localize();
            this.WindowSize        = new Vector2(700 * GuiWidget.DeviceScale, 600 * GuiWidget.DeviceScale);

            contentRow.Padding = contentRow.Padding.Clone(top: 0);

            var generalPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
            };

            contentRow.AddChild(generalPanel);

            var configureIcon = AggContext.StaticData.LoadIcon("fa-cog_16.png", 16, 16, theme.InvertIcons);

#if __ANDROID__
            // Camera Monitoring
            bool hasCamera = true || ApplicationSettings.Instance.get(ApplicationSettingsKey.HardwareHasCamera) == "true";

            var previewButton = new IconButton(configureIcon, theme)
            {
                ToolTipText = "Configure Camera View".Localize()
            };
            previewButton.Click += (s, e) =>
            {
                AppContext.Platform.OpenCameraPreview();
            };

            var printer = ApplicationController.Instance.ActivePrinter;

            this.AddSettingsRow(
                new SettingsItem(
                    "Camera Monitoring".Localize(),
                    theme,
                    new SettingsItem.ToggleSwitchConfig()
            {
                Checked      = printer.Settings.GetValue <bool>(SettingsKey.publish_bed_image),
                ToggleAction = (itemChecked) =>
                {
                    printer.Settings.SetValue(SettingsKey.publish_bed_image, itemChecked ? "1" : "0");
                }
            },
                    previewButton,
                    AggContext.StaticData.LoadIcon("camera-24x24.png", 24, 24)),
                generalPanel
                );
#endif
            // Print Notifications
            var configureNotificationsButton = new IconButton(configureIcon, theme)
            {
                Name        = "Configure Notification Settings Button",
                ToolTipText = "Configure Notifications".Localize(),
                Margin      = new BorderDouble(left: 6),
                VAnchor     = VAnchor.Center
            };
            configureNotificationsButton.Click += (s, e) =>
            {
                if (ApplicationController.ChangeToPrintNotification != null)
                {
                    UiThread.RunOnIdle(() =>
                    {
                        ApplicationController.ChangeToPrintNotification(this.DialogWindow);
                    });
                }
            };

            this.AddSettingsRow(
                new SettingsItem(
                    "Notifications".Localize(),
                    theme,
                    new SettingsItem.ToggleSwitchConfig()
            {
                Checked      = UserSettings.Instance.get(UserSettingsKey.PrintNotificationsEnabled) == "true",
                ToggleAction = (itemChecked) =>
                {
                    UserSettings.Instance.set(UserSettingsKey.PrintNotificationsEnabled, itemChecked ? "true" : "false");
                }
            },
                    configureNotificationsButton,
                    AggContext.StaticData.LoadIcon("notify-24x24.png", 16, 16, theme.InvertIcons)),
                generalPanel);

            // LanguageControl
            var languageSelector = new LanguageSelector(theme);
            languageSelector.SelectionChanged += (s, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    string languageCode = languageSelector.SelectedValue;
                    if (languageCode != UserSettings.Instance.get(UserSettingsKey.Language))
                    {
                        UserSettings.Instance.set(UserSettingsKey.Language, languageCode);

                        if (languageCode == "L10N")
                        {
#if DEBUG
                            AppContext.Platform.GenerateLocalizationValidationFile();
#endif
                        }

                        ApplicationController.Instance.ResetTranslationMap();
                        ApplicationController.Instance.ReloadAll();
                    }
                });
            };

            this.AddSettingsRow(new SettingsItem("Language".Localize(), languageSelector, theme), generalPanel);

#if !__ANDROID__
            // ThumbnailRendering
            var thumbnailsModeDropList = new DropDownList("", theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize)
            {
                BorderColor = theme.GetBorderColor(75)
            };
            thumbnailsModeDropList.AddItem("Flat".Localize(), "orthographic");
            thumbnailsModeDropList.AddItem("3D".Localize(), "raytraced");

            thumbnailsModeDropList.SelectedValue     = UserSettings.Instance.ThumbnailRenderingMode;
            thumbnailsModeDropList.SelectionChanged += (s, e) =>
            {
                string thumbnailRenderingMode = thumbnailsModeDropList.SelectedValue;
                if (thumbnailRenderingMode != UserSettings.Instance.ThumbnailRenderingMode)
                {
                    UserSettings.Instance.ThumbnailRenderingMode = thumbnailRenderingMode;

                    UiThread.RunOnIdle(() =>
                    {
                        // Ask if the user they would like to rebuild their thumbnails
                        StyledMessageBox.ShowMessageBox(
                            (bool rebuildThumbnails) =>
                        {
                            if (rebuildThumbnails)
                            {
                                string[] thumbnails = new string[]
                                {
                                    ApplicationController.CacheablePath(
                                        Path.Combine("Thumbnails", "Content"), ""),
                                    ApplicationController.CacheablePath(
                                        Path.Combine("Thumbnails", "Library"), "")
                                };
                                foreach (var directoryToRemove in thumbnails)
                                {
                                    try
                                    {
                                        if (Directory.Exists(directoryToRemove))
                                        {
                                            Directory.Delete(directoryToRemove, true);
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        GuiWidget.BreakInDebugger();
                                    }

                                    Directory.CreateDirectory(directoryToRemove);
                                }

                                ApplicationController.Instance.Library.NotifyContainerChanged();
                            }
                        },
                            "You are switching to a different thumbnail rendering mode. If you want, your current thumbnails can be removed and recreated in the new style. You can switch back and forth at any time. There will be some processing overhead while the new thumbnails are created.\n\nDo you want to rebuild your existing thumbnails now?".Localize(),
                            "Rebuild Thumbnails Now".Localize(),
                            StyledMessageBox.MessageType.YES_NO,
                            "Rebuild".Localize());
                    });
                }
            };

            this.AddSettingsRow(
                new SettingsItem(
                    "Thumbnails".Localize(),
                    thumbnailsModeDropList,
                    theme),
                generalPanel);
#endif

            // TextSize
            if (!double.TryParse(UserSettings.Instance.get(UserSettingsKey.ApplicationTextSize), out double currentTextSize))
            {
                currentTextSize = 1.0;
            }

            double sliderThumbWidth = 10 * GuiWidget.DeviceScale;
            double sliderWidth      = 100 * GuiWidget.DeviceScale;
            var    textSizeSlider   = new SolidSlider(new Vector2(), sliderThumbWidth, .7, 1.4)
            {
                Name               = "Text Size Slider",
                Margin             = new BorderDouble(5, 0),
                Value              = currentTextSize,
                HAnchor            = HAnchor.Stretch,
                VAnchor            = VAnchor.Center,
                TotalWidthInPixels = sliderWidth,
            };

            var optionalContainer = new FlowLayoutWidget()
            {
                VAnchor = VAnchor.Center | VAnchor.Fit,
                HAnchor = HAnchor.Fit
            };

            TextWidget sectionLabel = null;

            var textSizeApplyButton = new TextButton("Apply".Localize(), theme)
            {
                VAnchor         = VAnchor.Center,
                BackgroundColor = theme.SlightShade,
                Visible         = false,
                Margin          = new BorderDouble(right: 6)
            };
            textSizeApplyButton.Click += (s, e) =>
            {
                GuiWidget.DeviceScale = textSizeSlider.Value;
                ApplicationController.Instance.ReloadAll();
            };
            optionalContainer.AddChild(textSizeApplyButton);

            textSizeSlider.ValueChanged += (s, e) =>
            {
                double textSizeNew = textSizeSlider.Value;
                UserSettings.Instance.set(UserSettingsKey.ApplicationTextSize, textSizeNew.ToString("0.0"));
                sectionLabel.Text           = "Text Size".Localize() + $" : {textSizeNew:0.0}";
                textSizeApplyButton.Visible = textSizeNew != currentTextSize;
            };

            var section = new SettingsItem(
                "Text Size".Localize() + $" : {currentTextSize:0.0}",
                textSizeSlider,
                theme,
                optionalContainer);

            sectionLabel = section.Children <TextWidget>().FirstOrDefault();

            this.AddSettingsRow(section, generalPanel);

            themeColorPanel = new ThemeColorPanel(theme)
            {
                HAnchor = HAnchor.Stretch
            };

            var droplist = new DropDownList("Custom", theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize)
            {
                BorderColor = theme.GetBorderColor(75),
                Margin      = new BorderDouble(0, 0, 10, 0)
            };

            int i = 0;

            foreach (var item in AppContext.ThemeProviders)
            {
                var newItem = droplist.AddItem(item.Key);

                if (item.Value == themeColorPanel.ThemeProvider)
                {
                    droplist.SelectedIndex = i;
                }

                i++;
            }

            droplist.SelectionChanged += (s, e) =>
            {
                if (AppContext.ThemeProviders.TryGetValue(droplist.SelectedValue, out IColorTheme provider))
                {
                    themeColorPanel.ThemeProvider = provider;
                    UserSettings.Instance.set(UserSettingsKey.ThemeName, droplist.SelectedValue);
                }
            };

            var themeRow = new SettingsItem("Theme".Localize(), droplist, theme);
            generalPanel.AddChild(themeRow);
            generalPanel.AddChild(themeColorPanel);

            themeColorPanel.Border      = themeRow.Border;
            themeColorPanel.BorderColor = themeRow.BorderColor;
            themeRow.Border             = 0;

            var advancedPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                Margin = new BorderDouble(2, 0)
            };

            var sectionWidget = new SectionWidget("Advanced".Localize(), advancedPanel, theme, serializationKey: "ApplicationSettings-Advanced", expanded: false)
            {
                Name    = "Advanced Section",
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Margin  = 0
            };
            contentRow.AddChild(sectionWidget);

            theme.ApplyBoxStyle(sectionWidget);

            sectionWidget.Margin = new BorderDouble(0, 10);

            // Touch Screen Mode
            this.AddSettingsRow(
                new SettingsItem(
                    "Touch Screen Mode".Localize(),
                    theme,
                    new SettingsItem.ToggleSwitchConfig()
            {
                Checked      = UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode) == "touchscreen",
                ToggleAction = (itemChecked) =>
                {
                    string displayMode = itemChecked ? "touchscreen" : "responsive";
                    if (displayMode != UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode))
                    {
                        UserSettings.Instance.set(UserSettingsKey.ApplicationDisplayMode, displayMode);
                        ApplicationController.Instance.ReloadAll();
                    }
                }
            }),
                advancedPanel);

            var openCacheButton = new IconButton(AggContext.StaticData.LoadIcon("fa-link_16.png", 16, 16, theme.InvertIcons), theme)
            {
                ToolTipText = "Open Folder".Localize(),
            };
            openCacheButton.Click += (s, e) => UiThread.RunOnIdle(() =>
            {
                Process.Start(ApplicationDataStorage.ApplicationUserDataPath);
            });

            this.AddSettingsRow(
                new SettingsItem(
                    "Application Storage".Localize(),
                    openCacheButton,
                    theme),
                advancedPanel);

            var clearCacheButton = new HoverIconButton(AggContext.StaticData.LoadIcon("remove.png", 16, 16, theme.InvertIcons), theme)
            {
                ToolTipText = "Clear Cache".Localize(),
            };
            clearCacheButton.Click += (s, e) => UiThread.RunOnIdle(() =>
            {
                CacheDirectory.DeleteCacheData();
            });

            this.AddSettingsRow(
                new SettingsItem(
                    "Application Cache".Localize(),
                    clearCacheButton,
                    theme),
                advancedPanel);

            advancedPanel.Children <SettingsItem>().First().Border = new BorderDouble(0, 1);
        }
        private void AddAdvancedPannel(GuiWidget settingsColumn)
        {
            var advancedPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);

            var advancedSection = new SectionWidget("Advanced".Localize(), advancedPanel, theme, serializationKey: "ApplicationSettings-Advanced", expanded: false)
            {
                Name    = "Advanced Section",
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                Margin  = 0
            };

            settingsColumn.AddChild(advancedSection);

            theme.ApplyBoxStyle(advancedSection);

            // Touch Screen Mode
            this.AddSettingsRow(
                new SettingsItem(
                    "Touch Screen Mode".Localize(),
                    theme,
                    new SettingsItem.ToggleSwitchConfig()
            {
                Checked      = UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode) == "touchscreen",
                ToggleAction = (itemChecked) =>
                {
                    string displayMode = itemChecked ? "touchscreen" : "responsive";
                    if (displayMode != UserSettings.Instance.get(UserSettingsKey.ApplicationDisplayMode))
                    {
                        UserSettings.Instance.set(UserSettingsKey.ApplicationDisplayMode, displayMode);
                        UiThread.RunOnIdle(() => ApplicationController.Instance.ReloadAll().ConfigureAwait(false));
                    }
                }
            }),
                advancedPanel);

            AddUserBoolToggle(advancedPanel,
                              "Utilize High Res Monitors".Localize(),
                              UserSettingsKey.ApplicationUseHeigResDisplays,
                              true,
                              false);

            AddUserBoolToggle(advancedPanel,
                              "Enable Socketeer Client".Localize(),
                              UserSettingsKey.ApplicationUseSocketeer,
                              true,
                              false);

            var openCacheButton = new IconButton(AggContext.StaticData.LoadIcon("fa-link_16.png", 16, 16, theme.InvertIcons), theme)
            {
                ToolTipText = "Open Folder".Localize(),
            };

            openCacheButton.Click += (s, e) => UiThread.RunOnIdle(() =>
            {
                Process.Start(ApplicationDataStorage.ApplicationUserDataPath);
            });

            this.AddSettingsRow(
                new SettingsItem(
                    "Application Storage".Localize(),
                    openCacheButton,
                    theme),
                advancedPanel);

            var clearCacheButton = new HoverIconButton(AggContext.StaticData.LoadIcon("remove.png", 16, 16, theme.InvertIcons), theme)
            {
                ToolTipText = "Clear Cache".Localize(),
            };

            clearCacheButton.Click += (s, e) => UiThread.RunOnIdle(() =>
            {
                CacheDirectory.DeleteCacheData();
            });

            this.AddSettingsRow(
                new SettingsItem(
                    "Application Cache".Localize(),
                    clearCacheButton,
                    theme),
                advancedPanel);

#if DEBUG
            var configureIcon = AggContext.StaticData.LoadIcon("fa-cog_16.png", 16, 16, theme.InvertIcons);

            var configurePluginsButton = new IconButton(configureIcon, theme)
            {
                ToolTipText = "Configure Plugins".Localize(),
                Margin      = 0
            };
            configurePluginsButton.Click += (s, e) =>
            {
                UiThread.RunOnIdle(() =>
                {
                    DialogWindow.Show <PluginsPage>();
                });
            };

            this.AddSettingsRow(
                new SettingsItem(
                    "Plugins".Localize(),
                    configurePluginsButton,
                    theme),
                advancedPanel);
#endif

            advancedPanel.Children <SettingsItem>().First().Border = new BorderDouble(0, 1);
        }