Esempio n. 1
0
        //Save - Monitor Application Settings
        void Settings_Save()
        {
            try
            {
                cb_SettingsShortcutDisconnectBluetooth.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutDisconnectBluetooth", cb_SettingsShortcutDisconnectBluetooth.IsChecked.ToString());
                };

                cb_SettingsExclusiveGuide.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ExclusiveGuide", cb_SettingsExclusiveGuide.IsChecked.ToString());
                };

                cb_SettingsWindowsStartup.Click += (sender, e) =>
                {
                    AVSettings.ManageStartupShortcut("DirectXInput-Launcher.exe");
                };

                //Battery settings
                slider_BatteryLowLevel.ValueChanged += async(sender, e) =>
                {
                    string batteryLevelLowString = slider_BatteryLowLevel.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowLevel", batteryLevelLowString);
                    textblock_BatteryLowLevel.Text = textblock_BatteryLowLevel.Tag + ": " + batteryLevelLowString + "%";

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                cb_SettingsBatteryLowBlinkLed.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowBlinkLed", cb_SettingsBatteryLowBlinkLed.IsChecked.ToString());

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                cb_SettingsBatteryLowShowNotification.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowShowNotification", cb_SettingsBatteryLowShowNotification.IsChecked.ToString());

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                cb_SettingsBatteryLowPlaySound.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowPlaySound", cb_SettingsBatteryLowPlaySound.IsChecked.ToString());

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                //Controller settings
                slider_ControllerIdleDisconnectMin.ValueChanged += (sender, e) =>
                {
                    string controllerIdleDisconnectMinString = slider_ControllerIdleDisconnectMin.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "ControllerIdleDisconnectMin", controllerIdleDisconnectMinString);
                    textblock_ControllerIdleDisconnectMin.Text = textblock_ControllerIdleDisconnectMin.Tag + ": " + controllerIdleDisconnectMinString + " minutes";
                };

                colorpicker_Controller0.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor0", newBrush.ToString());
                        colorpicker_Controller0.Background = newBrush;
                        vController0.Color = newBrush.Color;
                        if (vController0 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController0);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                colorpicker_Controller1.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor1", newBrush.ToString());
                        colorpicker_Controller1.Background = newBrush;
                        vController1.Color = newBrush.Color;
                        if (vController1 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController1);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                colorpicker_Controller2.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor2", newBrush.ToString());
                        colorpicker_Controller2.Background = newBrush;
                        vController2.Color = newBrush.Color;
                        if (vController2 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController2);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                colorpicker_Controller3.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor3", newBrush.ToString());
                        colorpicker_Controller3.Background = newBrush;
                        vController3.Color = newBrush.Color;
                        if (vController3 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController3);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                //Shortcut settings
                cb_SettingsShortcutLaunchCtrlUI.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutLaunchCtrlUI", cb_SettingsShortcutLaunchCtrlUI.IsChecked.ToString());
                };

                cb_SettingsShortcutKeyboardPopup.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutKeyboardPopup", cb_SettingsShortcutKeyboardPopup.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutAltEnter.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutAltEnter", cb_SettingsShortcutAltEnter.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutAltTab.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutAltTab", cb_SettingsShortcutAltTab.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutScreenshotController.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutScreenshotController", cb_SettingsShortcutScreenshotController.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutScreenshotKeyboard.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutScreenshotKeyboard", cb_SettingsShortcutScreenshotKeyboard.IsChecked.ToString());
                };

                //Keyboard settings
                slider_KeyboardOpacity.ValueChanged += (sender, e) =>
                {
                    textblock_KeyboardOpacity.Text = textblock_KeyboardOpacity.Tag + ": " + slider_KeyboardOpacity.Value.ToString("0.00") + "%";
                    Setting_Save(vConfigurationDirectXInput, "KeyboardOpacity", slider_KeyboardOpacity.Value.ToString("0.00"));
                    App.vWindowKeyboard.UpdatePopupOpacity();
                };

                cb_SettingsKeyboardCloseNoController.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardCloseNoController", cb_SettingsKeyboardCloseNoController.IsChecked.ToString());
                };

                cb_SettingsKeyboardResetPosition.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardResetPosition", cb_SettingsKeyboardResetPosition.IsChecked.ToString());
                };

                combobox_KeyboardLayout.SelectionChanged += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardLayout", combobox_KeyboardLayout.SelectedIndex.ToString());
                    App.vWindowKeyboard.UpdateKeyboardLayout();
                };

                slider_SettingsKeyboardMouseMoveSensitivity.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsKeyboardMouseMoveSensitivity.Text = textblock_SettingsKeyboardMouseMoveSensitivity.Tag.ToString() + slider_SettingsKeyboardMouseMoveSensitivity.Value.ToString("0.00");
                    Setting_Save(vConfigurationDirectXInput, "KeyboardMouseMoveSensitivity", slider_SettingsKeyboardMouseMoveSensitivity.Value.ToString("0.00"));
                };

                slider_SettingsKeyboardMouseScrollSensitivity2.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsKeyboardMouseScrollSensitivity2.Text = textblock_SettingsKeyboardMouseScrollSensitivity2.Tag.ToString() + slider_SettingsKeyboardMouseScrollSensitivity2.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "KeyboardMouseScrollSensitivity2", slider_SettingsKeyboardMouseScrollSensitivity2.Value.ToString());
                };

                //Keypad settings
                slider_KeypadOpacity.ValueChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadOpacity = slider_KeypadOpacity.Value;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    textblock_KeypadOpacity.Text = textblock_KeypadOpacity.Tag + ": " + slider_KeypadOpacity.Value.ToString("0.00") + "%";
                    App.vWindowKeypad.UpdatePopupOpacity();
                };

                combobox_KeypadDisplayStyle.SelectionChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadDisplayStyle = combobox_KeypadDisplayStyle.SelectedIndex;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    App.vWindowKeypad.UpdateKeypadStyle();
                };

                slider_KeypadDisplaySize.ValueChanged += async(sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadDisplaySize = Convert.ToInt32(slider_KeypadDisplaySize.Value);

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    textblock_KeypadDisplaySize.Text = textblock_KeypadDisplaySize.Tag + ": " + selectedProfile.KeypadDisplaySize + "%";

                    //Update the keypad size
                    double keypadHeight = App.vWindowKeypad.UpdateKeypadSize();

                    //Notify - Fps Overlayer keypad size changed
                    await NotifyFpsOverlayerKeypadSizeChanged(Convert.ToInt32(keypadHeight));
                };

                cb_SettingsKeypadMouseMoveEnabled.Click += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadMouseMoveEnabled = (bool)cb_SettingsKeypadMouseMoveEnabled.IsChecked;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    //Update all keypad key names
                    App.vWindowKeypad.UpdateKeypadNames();
                };

                slider_SettingsKeypadMouseMoveSensitivity.ValueChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadMouseMoveSensitivity = slider_SettingsKeypadMouseMoveSensitivity.Value;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    textblock_SettingsKeypadMouseMoveSensitivity.Text = textblock_SettingsKeypadMouseMoveSensitivity.Tag + ": " + selectedProfile.KeypadMouseMoveSensitivity.ToString("0.00");
                };

                //Media settings
                combobox_ShortcutMuteFunction.SelectionChanged += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutMuteFunction", combobox_ShortcutMuteFunction.SelectedIndex.ToString());
                };

                slider_SettingsMediaVolumeStep.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsMediaVolumeStep.Text = textblock_SettingsMediaVolumeStep.Tag.ToString() + slider_SettingsMediaVolumeStep.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "MediaVolumeStep", slider_SettingsMediaVolumeStep.Value.ToString());
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to save the application settings: " + ex.Message);
            }
        }
Esempio n. 2
0
        //Save - Monitor Application Settings
        void Settings_Save()
        {
            try
            {
                cb_SettingsWindowsStartup.Click += (sender, e) =>
                {
                    AVSettings.ManageStartupShortcut("FpsOverlayer-Launcher.exe");
                };

                checkbox_DisplayBackground.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationFpsOverlayer, "DisplayBackground", checkbox_DisplayBackground.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                slider_DisplayOpacity.ValueChanged += async(sender, e) =>
                {
                    textblock_DisplayOpacity.Text = textblock_DisplayOpacity.Tag + ": " + slider_DisplayOpacity.Value.ToString("0.00") + "%";
                    Setting_Save(vConfigurationFpsOverlayer, "DisplayOpacity", slider_DisplayOpacity.Value.ToString("0.00"));
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                slider_HardwareUpdateRateMs.ValueChanged += (sender, e) =>
                {
                    textblock_HardwareUpdateRateMs.Text = textblock_HardwareUpdateRateMs.Tag + ": " + slider_HardwareUpdateRateMs.Value.ToString() + "ms";
                    Setting_Save(vConfigurationFpsOverlayer, "HardwareUpdateRateMs", slider_HardwareUpdateRateMs.Value.ToString());
                };

                slider_MarginHorizontal.ValueChanged += async(sender, e) =>
                {
                    textblock_MarginHorizontal.Text = textblock_MarginHorizontal.Tag + ": " + slider_MarginHorizontal.Value.ToString("0") + "px";
                    Setting_Save(vConfigurationFpsOverlayer, "MarginHorizontal", slider_MarginHorizontal.Value.ToString("0"));
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                slider_MarginVertical.ValueChanged += async(sender, e) =>
                {
                    textblock_MarginVertical.Text = textblock_MarginVertical.Tag + ": " + slider_MarginVertical.Value.ToString("0") + "px";
                    Setting_Save(vConfigurationFpsOverlayer, "MarginVertical", slider_MarginVertical.Value.ToString("0"));
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                checkbox_CheckTaskbarVisible.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationFpsOverlayer, "CheckTaskbarVisible", checkbox_CheckTaskbarVisible.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                combobox_InterfaceFontStyleName.SelectionChanged += async(sender, e) =>
                {
                    Setting_Save(vConfigurationFpsOverlayer, "InterfaceFontStyleName", combobox_InterfaceFontStyleName.SelectedItem.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                combobox_TextPosition.SelectionChanged += async(sender, e) =>
                {
                    Setting_Save(vConfigurationFpsOverlayer, "TextPosition", combobox_TextPosition.SelectedIndex.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                    await NotifyDirectXInputSettingChanged("TextPosition");
                };

                combobox_TextDirection.SelectionChanged += async(sender, e) =>
                {
                    Setting_Save(vConfigurationFpsOverlayer, "TextDirection", combobox_TextDirection.SelectedIndex.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                slider_TextSize.ValueChanged += async(sender, e) =>
                {
                    textblock_TextSize.Text = textblock_TextSize.Tag + ": " + slider_TextSize.Value.ToString("0") + "px";
                    Setting_Save(vConfigurationFpsOverlayer, "TextSize", slider_TextSize.Value.ToString("0"));
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                checkbox_TextColorSingle.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationFpsOverlayer, "TextColorSingle", checkbox_TextColorSingle.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };

                textbox_GpuCategoryTitle.TextChanged += async(sender, e) =>
                {
                    TextBox senderTextbox = (TextBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "GpuCategoryTitle", senderTextbox.Text);
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_GpuShowCategoryTitle.Click += async(sender, e) =>
                {
                    CheckBox senderCheckBox = (CheckBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "GpuShowCategoryTitle", senderCheckBox.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_GpuShowName.Click          += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowName", checkbox_GpuShowName.IsChecked.ToString()); };
                checkbox_GpuShowPercentage.Click    += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowPercentage", checkbox_GpuShowPercentage.IsChecked.ToString()); };
                checkbox_GpuShowMemoryUsed.Click    += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowMemoryUsed", checkbox_GpuShowMemoryUsed.IsChecked.ToString()); };
                checkbox_GpuShowTemperature.Click   += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowTemperature", checkbox_GpuShowTemperature.IsChecked.ToString()); };
                checkbox_GpuShowCoreFrequency.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowCoreFrequency", checkbox_GpuShowCoreFrequency.IsChecked.ToString()); };
                checkbox_GpuShowFanSpeed.Click      += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowFanSpeed", checkbox_GpuShowFanSpeed.IsChecked.ToString()); };
                checkbox_GpuShowPowerWatt.Click     += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowPowerWatt", checkbox_GpuShowPowerWatt.IsChecked.ToString()); };
                checkbox_GpuShowPowerVolt.Click     += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "GpuShowPowerVolt", checkbox_GpuShowPowerVolt.IsChecked.ToString()); };

                textbox_CpuCategoryTitle.TextChanged += async(sender, e) =>
                {
                    TextBox senderTextbox = (TextBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "CpuCategoryTitle", senderTextbox.Text);
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_CpuShowCategoryTitle.Click += async(sender, e) =>
                {
                    CheckBox senderCheckBox = (CheckBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "CpuShowCategoryTitle", senderCheckBox.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_CpuShowName.Click          += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "CpuShowName", checkbox_CpuShowName.IsChecked.ToString()); };
                checkbox_CpuShowPercentage.Click    += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "CpuShowPercentage", checkbox_CpuShowPercentage.IsChecked.ToString()); };
                checkbox_CpuShowTemperature.Click   += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "CpuShowTemperature", checkbox_CpuShowTemperature.IsChecked.ToString()); };
                checkbox_CpuShowCoreFrequency.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "CpuShowCoreFrequency", checkbox_CpuShowCoreFrequency.IsChecked.ToString()); };
                checkbox_CpuShowPowerWatt.Click     += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "CpuShowPowerWatt", checkbox_CpuShowPowerWatt.IsChecked.ToString()); };
                checkbox_CpuShowPowerVolt.Click     += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "CpuShowPowerVolt", checkbox_CpuShowPowerVolt.IsChecked.ToString()); };
                checkbox_CpuShowFanSpeed.Click      += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "CpuShowFanSpeed", checkbox_CpuShowFanSpeed.IsChecked.ToString()); };

                textbox_MemCategoryTitle.TextChanged += async(sender, e) =>
                {
                    TextBox senderTextbox = (TextBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "MemCategoryTitle", senderTextbox.Text);
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_MemShowCategoryTitle.Click += async(sender, e) =>
                {
                    CheckBox senderCheckBox = (CheckBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "MemShowCategoryTitle", senderCheckBox.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_MemShowPercentage.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MemShowPercentage", checkbox_MemShowPercentage.IsChecked.ToString()); };
                checkbox_MemShowUsed.Click       += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MemShowUsed", checkbox_MemShowUsed.IsChecked.ToString()); };
                checkbox_MemShowFree.Click       += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MemShowFree", checkbox_MemShowFree.IsChecked.ToString()); };
                checkbox_MemShowTotal.Click      += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MemShowTotal", checkbox_MemShowTotal.IsChecked.ToString()); };

                textbox_NetCategoryTitle.TextChanged += async(sender, e) =>
                {
                    TextBox senderTextbox = (TextBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "NetCategoryTitle", senderTextbox.Text);
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_NetShowCategoryTitle.Click += async(sender, e) =>
                {
                    CheckBox senderCheckBox = (CheckBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "NetShowCategoryTitle", senderCheckBox.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_NetShowCurrentUsage.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "NetShowCurrentUsage", checkbox_NetShowCurrentUsage.IsChecked.ToString()); };

                checkbox_AppShowName.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "AppShowName", checkbox_AppShowName.IsChecked.ToString()); };

                textbox_BatCategoryTitle.TextChanged += async(sender, e) =>
                {
                    TextBox senderTextbox = (TextBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "BatCategoryTitle", senderTextbox.Text);
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_BatShowCategoryTitle.Click += async(sender, e) =>
                {
                    CheckBox senderCheckBox = (CheckBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "BatShowCategoryTitle", senderCheckBox.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_BatShowPercentage.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "BatShowPercentage", checkbox_BatShowPercentage.IsChecked.ToString()); };

                checkbox_TimeShowCurrentTime.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "TimeShowCurrentTime", checkbox_TimeShowCurrentTime.IsChecked.ToString()); };

                textbox_MonCategoryTitle.TextChanged += async(sender, e) =>
                {
                    TextBox senderTextbox = (TextBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "MonCategoryTitle", senderTextbox.Text);
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_MonShowCategoryTitle.Click += async(sender, e) =>
                {
                    CheckBox senderCheckBox = (CheckBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "MonShowCategoryTitle", senderCheckBox.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_MonShowResolution.Click    += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MonShowResolution", checkbox_MonShowResolution.IsChecked.ToString()); };
                checkbox_MonShowDpiResolution.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MonShowDpiResolution", checkbox_MonShowDpiResolution.IsChecked.ToString()); };
                checkbox_MonShowColorBitDepth.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MonShowColorBitDepth", checkbox_MonShowColorBitDepth.IsChecked.ToString()); };
                checkbox_MonShowRefreshRate.Click   += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "MonShowRefreshRate", checkbox_MonShowRefreshRate.IsChecked.ToString()); };

                textbox_FpsCategoryTitle.TextChanged += async(sender, e) =>
                {
                    TextBox senderTextbox = (TextBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "FpsCategoryTitle", senderTextbox.Text);
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_FpsShowCategoryTitle.Click += async(sender, e) =>
                {
                    CheckBox senderCheckBox = (CheckBox)sender;
                    Setting_Save(vConfigurationFpsOverlayer, "FpsShowCategoryTitle", senderCheckBox.IsChecked.ToString());
                    await App.vWindowMain.UpdateFpsOverlayStyle();
                };
                checkbox_FpsShowCurrentFps.Click     += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "FpsShowCurrentFps", checkbox_FpsShowCurrentFps.IsChecked.ToString()); };
                checkbox_FpsShowCurrentLatency.Click += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "FpsShowCurrentLatency", checkbox_FpsShowCurrentLatency.IsChecked.ToString()); };
                checkbox_FpsShowAverageFps.Click     += (sender, e) => { Setting_Save(vConfigurationFpsOverlayer, "FpsShowAverageFps", checkbox_FpsShowAverageFps.IsChecked.ToString()); };

                colorpicker_ColorSingle.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorSingle.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorSingle", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorBackground.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorBackground.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorBackground", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorGpu.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorGpu.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorGpu", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorCpu.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorCpu.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorCpu", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorMem.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorMem.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorMem", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorNet.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorNet.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorNet", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorApp.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorApp.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorApp", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorBat.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorBat.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorBat", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorTime.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorTime.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorTime", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorMon.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorMon.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorMon", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };

                colorpicker_ColorFps.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        colorpicker_ColorFps.Background = newBrush;
                        Setting_Save(vConfigurationFpsOverlayer, "ColorFps", newColor.ToString());
                        await App.vWindowMain.UpdateFpsOverlayStyle();
                    }
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to save the application settings: " + ex.Message);
            }
        }
Esempio n. 3
0
        //Save - Monitor Application Settings
        void Settings_Save()
        {
            try
            {
                cb_SettingsLaunchFullscreen.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "LaunchFullscreen", cb_SettingsLaunchFullscreen.IsChecked.ToString());
                    if ((bool)cb_SettingsLaunchFullscreen.IsChecked)
                    {
                        cb_SettingsLaunchMinimized.IsChecked = false;
                        Setting_Save(vConfigurationCtrlUI, "LaunchMinimized", cb_SettingsLaunchMinimized.IsChecked.ToString());
                    }
                };

                cb_SettingsLaunchMinimized.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "LaunchMinimized", cb_SettingsLaunchMinimized.IsChecked.ToString());
                    if ((bool)cb_SettingsLaunchMinimized.IsChecked)
                    {
                        cb_SettingsLaunchFullscreen.IsChecked = false;
                        Setting_Save(vConfigurationCtrlUI, "LaunchFullscreen", cb_SettingsLaunchFullscreen.IsChecked.ToString());
                    }
                };

                cb_SettingsShowMediaMain.Click     += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "ShowMediaMain", cb_SettingsShowMediaMain.IsChecked.ToString()); };
                cb_SettingsMinimizeAppOnShow.Click += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "MinimizeAppOnShow", cb_SettingsMinimizeAppOnShow.IsChecked.ToString()); };

                cb_SettingsLaunchFpsOverlayer.Click += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "LaunchFpsOverlayer", cb_SettingsLaunchFpsOverlayer.IsChecked.ToString()); };
                cb_SettingsLaunchDirectXInput.Click += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "LaunchDirectXInput", cb_SettingsLaunchDirectXInput.IsChecked.ToString()); };

                cb_SettingsShowOtherShortcuts.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowOtherShortcuts", cb_SettingsShowOtherShortcuts.IsChecked.ToString());
                };

                cb_SettingsShowOtherProcesses.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowOtherProcesses", cb_SettingsShowOtherProcesses.IsChecked.ToString());
                };

                cb_SettingsHideAppProcesses.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "HideAppProcesses", cb_SettingsHideAppProcesses.IsChecked.ToString());
                };

                cb_SettingsShowLibrarySteam.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibrarySteam", cb_SettingsShowLibrarySteam.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.Steam;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryEADesktop.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryEADesktop", cb_SettingsShowLibraryEADesktop.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.EADesktop;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryEpic.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryEpic", cb_SettingsShowLibraryEpic.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.Epic;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryUbisoft.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryUbisoft", cb_SettingsShowLibraryUbisoft.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.Ubisoft;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryGoG.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryGoG", cb_SettingsShowLibraryGoG.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.GoG;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryBattleNet.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryBattleNet", cb_SettingsShowLibraryBattleNet.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.BattleNet;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryBethesda.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryBethesda", cb_SettingsShowLibraryBethesda.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.Bethesda;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryRockstar.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryRockstar", cb_SettingsShowLibraryRockstar.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.Rockstar;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryAmazon.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryAmazon", cb_SettingsShowLibraryAmazon.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.Amazon;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsShowLibraryUwp.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "ShowLibraryUwp", cb_SettingsShowLibraryUwp.IsChecked.ToString());
                    Func <DataBindApp, bool> filterLauncherApp = x => x.Category == AppCategory.Launcher && x.Launcher == AppLauncher.UWP;
                    await ListBoxRemoveAll(lb_Launchers, List_Launchers, filterLauncherApp);
                };

                cb_SettingsHideBatteryLevel.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "HideBatteryLevel", cb_SettingsHideBatteryLevel.IsChecked.ToString());
                    if ((bool)cb_SettingsHideBatteryLevel.IsChecked)
                    {
                        HideBatteryStatus(true);
                    }
                };

                cb_SettingsHideMouseCursor.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "HideMouseCursor", cb_SettingsHideMouseCursor.IsChecked.ToString());
                    if ((bool)cb_SettingsHideMouseCursor.IsChecked)
                    {
                        TaskStart_ShowHideMouseCursor();
                        MouseCursorShow();
                    }
                    else
                    {
                        await AVActions.TaskStopLoop(vTask_ShowHideMouse, 5000);

                        MouseCursorShow();
                    }
                };

                cb_SettingsHideControllerHelp.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "HideControllerHelp", cb_SettingsHideControllerHelp.IsChecked.ToString());
                    UpdateControllerHelp();
                };

                cb_SettingsShowHiddenFilesFolders.Click += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "ShowHiddenFilesFolders", cb_SettingsShowHiddenFilesFolders.IsChecked.ToString()); };
                cb_SettingsHideNetworkDrives.Click      += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "HideNetworkDrives", cb_SettingsHideNetworkDrives.IsChecked.ToString()); };
                cb_SettingsNotReadyNetworkDrives.Click  += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "NotReadyNetworkDrives", cb_SettingsNotReadyNetworkDrives.IsChecked.ToString()); };

                cb_SettingsInterfaceSound.Click += (sender, e) => { Setting_Save(vConfigurationCtrlUI, "InterfaceSound", cb_SettingsInterfaceSound.IsChecked.ToString()); };

                cb_SettingsWindowsStartup.Click += (sender, e) =>
                {
                    AVSettings.ManageStartupShortcut("CtrlUI-Launcher.exe");
                };

                slider_SettingsFontSize.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsFontSize.Text = "Adjust the application font size: " + Convert.ToInt32(slider_SettingsFontSize.Value);
                    Setting_Save(vConfigurationCtrlUI, "AppFontSize", Convert.ToInt32(slider_SettingsFontSize.Value).ToString());
                    AdjustApplicationFontSize();
                };

                slider_SettingsDisplayMonitor.ValueChanged += async(sender, e) =>
                {
                    textblock_SettingsDisplayMonitor.Text = "Monitor to display the applications on: " + Convert.ToInt32(slider_SettingsDisplayMonitor.Value);
                    Setting_Save(vConfigurationCtrlUI, "DisplayMonitor", Convert.ToInt32(slider_SettingsDisplayMonitor.Value).ToString());
                    await UpdateWindowPosition(true, false);
                };

                cb_SettingsMonitorPreventSleep.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "MonitorPreventSleep", cb_SettingsMonitorPreventSleep.IsChecked.ToString());
                    //Prevent or allow monitor sleep
                    UpdateMonitorSleepAuto();
                };

                slider_AdjustChromiumDpi.ValueChanged += (sender, e) =>
                {
                    textblock_AdjustChromiumDpi.Text = textblock_AdjustChromiumDpi.Tag + ": +" + slider_AdjustChromiumDpi.Value.ToString("0.00") + "%";
                    Setting_Save(vConfigurationCtrlUI, "AdjustChromiumDpi", slider_AdjustChromiumDpi.Value.ToString("0.00"));
                };

                slider_SettingsSoundVolume.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsSoundVolume.Text = "User interface sound volume: " + Convert.ToInt32(slider_SettingsSoundVolume.Value) + "%";
                    Setting_Save(vConfigurationCtrlUI, "InterfaceSoundVolume", Convert.ToInt32(slider_SettingsSoundVolume.Value).ToString());
                };

                //Background Settings
                cb_SettingsVideoBackground.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "VideoBackground", cb_SettingsVideoBackground.IsChecked.ToString());
                    UpdateBackgroundMedia(false);
                };

                cb_SettingsDesktopBackground.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationCtrlUI, "DesktopBackground", cb_SettingsDesktopBackground.IsChecked.ToString());
                    UpdateBackgroundMedia(false);
                };

                slider_SettingsBackgroundBrightness.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsBackgroundBrightness.Text = "Background brightness: " + Convert.ToInt32(slider_SettingsBackgroundBrightness.Value) + "%";
                    Setting_Save(vConfigurationCtrlUI, "BackgroundBrightness", Convert.ToInt32(slider_SettingsBackgroundBrightness.Value).ToString());
                    //UpdateBackgroundBrightness();
                };

                slider_SettingsBackgroundPlayVolume.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsBackgroundPlayVolume.Text = "Video playback volume: " + Convert.ToInt32(slider_SettingsBackgroundPlayVolume.Value) + "%";
                    Setting_Save(vConfigurationCtrlUI, "BackgroundPlayVolume", Convert.ToInt32(slider_SettingsBackgroundPlayVolume.Value).ToString());
                    UpdateBackgroundPlayVolume();
                };

                slider_SettingsBackgroundPlaySpeed.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsBackgroundPlaySpeed.Text = "Video playback speed: " + Convert.ToInt32(slider_SettingsBackgroundPlaySpeed.Value) + "%";
                    Setting_Save(vConfigurationCtrlUI, "BackgroundPlaySpeed", Convert.ToInt32(slider_SettingsBackgroundPlaySpeed.Value).ToString());
                    UpdateBackgroundPlaySpeed();
                };

                //Save - Socket Client Port
                txt_SettingsSocketClientPortStart.TextChanged += (sender, e) =>
                {
                    //Color brushes
                    BrushConverter BrushConvert = new BrushConverter();
                    Brush          BrushInvalid = BrushConvert.ConvertFromString("#CD1A2B") as Brush;
                    Brush          BrushValid   = BrushConvert.ConvertFromString("#1DB954") as Brush;

                    if (string.IsNullOrWhiteSpace(txt_SettingsSocketClientPortStart.Text))
                    {
                        txt_SettingsSocketClientPortStart.BorderBrush = BrushInvalid;
                        txt_SettingsSocketClientPortRange.BorderBrush = BrushInvalid;
                        return;
                    }

                    if (Regex.IsMatch(txt_SettingsSocketClientPortStart.Text, "(\\D+)"))
                    {
                        txt_SettingsSocketClientPortStart.BorderBrush = BrushInvalid;
                        txt_SettingsSocketClientPortRange.BorderBrush = BrushInvalid;
                        return;
                    }

                    int NewServerPort = Convert.ToInt32(txt_SettingsSocketClientPortStart.Text);
                    if (NewServerPort < 100 || NewServerPort > 65500)
                    {
                        txt_SettingsSocketClientPortStart.BorderBrush = BrushInvalid;
                        txt_SettingsSocketClientPortRange.BorderBrush = BrushInvalid;
                        return;
                    }

                    txt_SettingsSocketClientPortStart.BorderBrush = BrushValid;
                    txt_SettingsSocketClientPortRange.BorderBrush = BrushValid;
                    txt_SettingsSocketClientPortRange.Text        = Convert.ToString(NewServerPort + 2);
                    Setting_Save(vConfigurationCtrlUI, "ServerPort", txt_SettingsSocketClientPortStart.Text);
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to save the application settings: " + ex.Message);
            }
        }