예제 #1
0
        void LoadSettings()
        {
            foreach (SettingBase setting in SettingsDefinitions)
            {
                if (!FilterStrings.Contains(setting.Filter))
                {
                    FilterStrings.Add(setting.Filter);
                }

                foreach (ConfItem confItem in ConfItems)
                {
                    if (setting.Name == confItem.Name && confItem.Section == "" && !confItem.IsSectionItem)
                    {
                        setting.Value        = confItem.Value.Trim('\'', '"');
                        setting.ConfItem     = confItem;
                        confItem.SettingBase = setting;
                        continue;
                    }
                }

                switch (setting)
                {
                case StringSetting s:
                    var sc = new StringSettingControl(s);
                    MainStackPanel.Children.Add(sc);
                    break;

                case OptionSetting s:
                    var oc = new OptionSettingControl(s);
                    MainStackPanel.Children.Add(oc);
                    break;
                }
            }
        }
예제 #2
0
        private void LoadSettings(List <SettingBase> settingsDefinitions,
                                  Dictionary <string, string> confSettings)
        {
            foreach (SettingBase setting in settingsDefinitions)
            {
                if (!FilterStrings.Contains(setting.Filter))
                {
                    FilterStrings.Add(setting.Filter);
                }

                foreach (var pair in confSettings)
                {
                    if (setting.Name == pair.Key)
                    {
                        setting.Value = pair.Value.Trim('\'', '"');
                        continue;
                    }
                }

                switch (setting)
                {
                case StringSetting s:
                    var sc = new StringSettingControl(s);
                    sc.TitleTextBox.Foreground = WPF.WPF.ThemeBrush;
                    MainStackPanel.Children.Add(sc);
                    break;

                case OptionSetting s:
                    var oc = new OptionSettingControl(s);
                    oc.TitleTextBox.Foreground = WPF.WPF.ThemeBrush;
                    MainStackPanel.Children.Add(oc);
                    break;
                }
            }
        }