Example #1
0
        private void SetupEntries()
        {
            this.DoForEveryControl((Control TP) =>
            {
                if (TP.GetType() == typeof(TabPage))
                {
                    TP.DoForEveryControl((Control c) =>
                    {
                        string Name = _settings.DefaultApp;
                        if (c.GetType() == typeof(Label))
                        {
                            return(true);
                        }

                        if (TP.Tag.ToString() == "Added")
                        {
                            Name = TP.Name;
                        }
                        IPlugin curPlugin     = GetPluginByName(Name);
                        IFunction curFunction = null;
                        if (curPlugin != null)
                        {
                            curFunction = (IFunction)curPlugin;
                        }

                        string SettingsKey = c.Tag.ToString();
                        if (c.GetType() == typeof(CheckBox))
                        {
                            CheckBox cb = (CheckBox)c;
                            cb.Checked  = _settings.GetBoolValue(Name, SettingsKey);

                            if (curFunction != null)
                            {
                                curFunction.Settings.UpdateValue(SettingsKey, cb.Checked);
                            }
                        }
                        if (c.GetType() == typeof(TrackBar))
                        {
                            TrackBar tbar   = (TrackBar)c;
                            int loadetValue = Settings.GetIntValue(Name, SettingsKey) < tbar.Minimum ? tbar.Minimum : Settings.GetIntValue(Name, SettingsKey);
                            loadetValue     = loadetValue > tbar.Maximum ? tbar.Maximum : loadetValue;
                            tbar.Value      = loadetValue;
                        }
                        return(true);
                    });
                }

                return(true);
            });
        }
Example #2
0
        private void Default_OK_Click(object sender, EventArgs e)
        {
            this.DoForEveryControl((Control TP) => {
                if (TP.GetType() == typeof(TabPage))
                {
                    TP.DoForEveryControl((Control c) =>
                    {
                        if (c.GetType() == typeof(Label))
                        {
                            return(true);
                        }
                        string Name = _settings.DefaultApp;
                        if (TP.Tag.ToString() == "Added")
                        {
                            Name = TP.Name;
                            UpdatePlugins(Name, (TabPage)TP);
                        }

                        string SettingsName = c.Tag.ToString();
                        if (SettingsName == "")
                        {
                            return(false);
                        }


                        if (c.GetType() == typeof(CheckBox))
                        {
                            CheckBox box = (CheckBox)c;
                            Settings.AddOrChangeKeyValue(Name, SettingsName, box.Checked);
                        }
                        if (c.GetType() == typeof(TrackBar))
                        {
                            TrackBar tbar = (TrackBar)c;
                            Settings.AddOrChangeKeyValue(Name, SettingsName, tbar.Value);
                        }
                        return(true);
                    });
                }
                return(true);
            });
            _save = true;



            this.Close();
        }