Exemple #1
0
        private bool SaveLayoutOptions()
        {
            // Validate input.
            foreach (var control in ColorsDockPanel.GetChildren())
            {
                if (control is TextBox)
                {
                    if (!Configuration.IsValidHtmlColor(((TextBox)control).Text))
                    {
                        LayoutTab.Focus();
                        MessageBox.Show(
                            "Please enter a valid HTML color code.  Accepted formats are #RGB, #RRGGBB, and #AARRGGBB.  Example: #3266CF",
                            "vmPing Error",
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                        ((TextBox)control).Focus();
                        ((TextBox)control).SelectAll();

                        return(false);
                    }
                }
            }

            ApplicationOptions.BackgroundColor_Probe_Inactive      = BackgroundColor_Probe_Inactive.Text;
            ApplicationOptions.BackgroundColor_Probe_Up            = BackgroundColor_Probe_Up.Text;
            ApplicationOptions.BackgroundColor_Probe_Down          = BackgroundColor_Probe_Down.Text;
            ApplicationOptions.BackgroundColor_Probe_Indeterminate = BackgroundColor_Probe_Indeterminate.Text;
            ApplicationOptions.BackgroundColor_Probe_Error         = BackgroundColor_Probe_Error.Text;
            ApplicationOptions.ForegroundColor_Probe_Inactive      = ForegroundColor_Probe_Inactive.Text;
            ApplicationOptions.ForegroundColor_Probe_Up            = ForegroundColor_Probe_Up.Text;
            ApplicationOptions.ForegroundColor_Probe_Down          = ForegroundColor_Probe_Down.Text;
            ApplicationOptions.ForegroundColor_Probe_Indeterminate = ForegroundColor_Probe_Indeterminate.Text;
            ApplicationOptions.ForegroundColor_Probe_Error         = ForegroundColor_Probe_Error.Text;
            ApplicationOptions.ForegroundColor_Stats_Inactive      = ForegroundColor_Stats_Inactive.Text;
            ApplicationOptions.ForegroundColor_Stats_Up            = ForegroundColor_Stats_Up.Text;
            ApplicationOptions.ForegroundColor_Stats_Down          = ForegroundColor_Stats_Down.Text;
            ApplicationOptions.ForegroundColor_Stats_Indeterminate = ForegroundColor_Stats_Indeterminate.Text;
            ApplicationOptions.ForegroundColor_Stats_Error         = ForegroundColor_Stats_Error.Text;
            ApplicationOptions.ForegroundColor_Alias_Inactive      = ForegroundColor_Alias_Inactive.Text;
            ApplicationOptions.ForegroundColor_Alias_Up            = ForegroundColor_Alias_Up.Text;
            ApplicationOptions.ForegroundColor_Alias_Down          = ForegroundColor_Alias_Down.Text;
            ApplicationOptions.ForegroundColor_Alias_Indeterminate = ForegroundColor_Alias_Indeterminate.Text;
            ApplicationOptions.ForegroundColor_Alias_Error         = ForegroundColor_Alias_Error.Text;

            return(true);
        }
        private bool SaveLayoutOptions()
        {
            // Validate input.
            foreach (var control in ColorsDockPanel.GetChildren())
            {
                if (!(control is TextBox textBox))
                {
                    continue;
                }

                if (Util.IsValidHtmlColor(textBox.Text))
                {
                    continue;
                }

                ShowError("Please enter a valid HTML color code.  Accepted formats are #RGB, #RRGGBB, and #AARRGGBB.  Example: #3266CF", LayoutTab, textBox);
                textBox.SelectAll();

                return(false);
            }

            ApplicationOptions.BackgroundColor_Probe_Inactive      = BackgroundColor_Probe_Inactive.Text;
            ApplicationOptions.BackgroundColor_Probe_Up            = BackgroundColor_Probe_Up.Text;
            ApplicationOptions.BackgroundColor_Probe_Down          = BackgroundColor_Probe_Down.Text;
            ApplicationOptions.BackgroundColor_Probe_Indeterminate = BackgroundColor_Probe_Indeterminate.Text;
            ApplicationOptions.BackgroundColor_Probe_Error         = BackgroundColor_Probe_Error.Text;
            ApplicationOptions.ForegroundColor_Probe_Inactive      = ForegroundColor_Probe_Inactive.Text;
            ApplicationOptions.ForegroundColor_Probe_Up            = ForegroundColor_Probe_Up.Text;
            ApplicationOptions.ForegroundColor_Probe_Down          = ForegroundColor_Probe_Down.Text;
            ApplicationOptions.ForegroundColor_Probe_Indeterminate = ForegroundColor_Probe_Indeterminate.Text;
            ApplicationOptions.ForegroundColor_Probe_Error         = ForegroundColor_Probe_Error.Text;
            ApplicationOptions.ForegroundColor_Stats_Inactive      = ForegroundColor_Stats_Inactive.Text;
            ApplicationOptions.ForegroundColor_Stats_Up            = ForegroundColor_Stats_Up.Text;
            ApplicationOptions.ForegroundColor_Stats_Down          = ForegroundColor_Stats_Down.Text;
            ApplicationOptions.ForegroundColor_Stats_Indeterminate = ForegroundColor_Stats_Indeterminate.Text;
            ApplicationOptions.ForegroundColor_Stats_Error         = ForegroundColor_Stats_Error.Text;
            ApplicationOptions.ForegroundColor_Alias_Inactive      = ForegroundColor_Alias_Inactive.Text;
            ApplicationOptions.ForegroundColor_Alias_Up            = ForegroundColor_Alias_Up.Text;
            ApplicationOptions.ForegroundColor_Alias_Down          = ForegroundColor_Alias_Down.Text;
            ApplicationOptions.ForegroundColor_Alias_Indeterminate = ForegroundColor_Alias_Indeterminate.Text;
            ApplicationOptions.ForegroundColor_Alias_Error         = ForegroundColor_Alias_Error.Text;

            return(true);
        }