Exemplo n.º 1
0
        public bool updateSettings(AllSettings update)
        {
            stopThread();

            Setting temp = null;

            temp = update.getSetting("userrate");
            if (temp != null)
            {
                useRR = temp.trueVal;
            }
            else
            {
                useRR = false;
            }

            temp = update.getSetting("rrate");
            if (temp != null)
            {
                refreshRate = temp.trueVal;
                if (!isValidRefreshRate(refreshRate))
                {
                    useRR = false;
                }
            }
            else
            {
                useRR = false;
            }

            temp = update.getSetting("usedbright");
            if (temp != null)
            {
                useDefBright = temp.trueVal;
            }
            else
            {
                useDefBright = false;
            }

            temp = update.getSetting("dbright");
            if (temp != null)
            {
                defaultBrightness = temp.trueVal;
                if (!isValidBrightness(defaultBrightness))
                {
                    useDefBright = false;
                }
            }
            else
            {
                useDefBright = false;
            }

            startThread();


            return(true);
        }
Exemplo n.º 2
0
        private void updateSetting(String name, String value)
        {
            //Add Setting to global list
            if (!globalSettings.overrideSetting(name, value))
            {
                settingsCreationError();
            }

            //Update EnforcerThread
            if (running != null)
            {
                running.updateSettings(globalSettings);
            }

            Setting temp = globalSettings.getSetting("skiplines");

            if (temp != null && temp.trueVal)
            {
                skipslines = true;
            }
            else
            {
                skipslines = false;
            }

            //Save Settings To file
            FileManager fm = new FileManager(fileLoc, fileNameS);

            fm.saveAllSettings(globalSettings);
        }
Exemplo n.º 3
0
        private void applySettings(AllSettings toDisplay)
        {
            Setting temp; //Stores setting so global setting list does not have to be traversed more than once per lookup

            temp = toDisplay.getSetting("usedbright");
            if (temp != null && temp.trueVal) //If setting exists and is true
            {
                checkBox1.Checked    = true;
                checkBox1.CheckState = CheckState.Indeterminate;

                temp = toDisplay.getSetting("dbright");
                if (temp == null) //If the user messes with the data file, this can happen
                {
                    label6.Text = "(Current: 100)";
                    updateSetting("dbright", "100");
                }
                else
                {
                    label6.Text = "(Current: " + temp.trueVal.ToString() + ")";
                }
            }
            else
            {
                checkBox1.Checked = false;
            }

            temp = toDisplay.getSetting("minwin");
            if (temp != null && temp.trueVal)
            {
                checkBox2.Checked    = true;
                checkBox2.CheckState = CheckState.Indeterminate;
                this.WindowState     = FormWindowState.Minimized;
            }
            else
            {
                checkBox2.Checked = false;
            }

            temp = toDisplay.getSetting("userrate");
            if (temp != null && temp.trueVal)
            {
                checkBox3.Checked    = true;
                checkBox3.CheckState = CheckState.Indeterminate;
            }
            else
            {
                checkBox3.Checked = false;
            }

            temp = toDisplay.getSetting("skiplines");
            if (temp != null && temp.trueVal)
            {
                checkBox4.Checked    = true;
                checkBox4.CheckState = CheckState.Indeterminate;
                skipslines           = true;
            }
            else
            {
                checkBox4.Checked = false;
                skipslines        = false;
            }
        }