コード例 #1
0
        public void UpdateSettingsMap()
        {
            // Link control with INI key. Value/Text of control will be automatically tracked and INI file updated.
            // INI setting keys with controls.
            var section = SettingsManager.OptionsSection;

            SettingsManager.AddMap(section, () => SettingName.DebugMode, DebugModeCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Log, EnableLoggingCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Console, ConsoleCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Version, ConfigurationVersionTextBox);
            // Stored inside XML now.
            var o = SettingsManager.Options;

            SettingsManager.LoadAndMonitor(x => x.GameScanLocations, GameScanLocationsListBox, o.GameScanLocations);
            SettingsManager.LoadAndMonitor(x => x.StartWithWindows, StartWithWindowsCheckBox);
            SettingsManager.LoadAndMonitor(x => x.StartWithWindowsState, StartWithWindowsStateComboBox, Enum.GetValues(typeof(FormWindowState)));
            SettingsManager.LoadAndMonitor(x => x.AlwaysOnTop, AlwaysOnTopCheckBox);
            SettingsManager.LoadAndMonitor(x => x.AllowOnlyOneCopy, AllowOnlyOneCopyCheckBox);
            SettingsManager.LoadAndMonitor(x => x.RemoteEnabled, RemoteEnabledCheckBox);
            SettingsManager.LoadAndMonitor(x => x.EnableShowFormInfo, ShowFormInfoCheckBox);
            SettingsManager.LoadAndMonitor(x => x.ShowTestButton, ShowTestButtonCheckBox);
            SettingsManager.LoadAndMonitor(x => x.UseDeviceBufferedData, UseDeviceBufferedDataCheckBox);
            SettingsManager.LoadAndMonitor(x => x.GuideButtonAction, GuideButtonActionTextBox);
            SettingsManager.LoadAndMonitor(x => x.AutoDetectForegroundWindow, AutoDetectForegroundWindowCheckBox);
            SettingsManager.LoadAndMonitor(x => x.IsProcessDPIAware, IsProcessDPIAwareCheckBox);
            // Load other settings manually.
            LoadSettings();
            // Attach event which will save form settings before Save().
            SettingsManager.OptionsData.Saving += OptionsData_Saving;
        }
コード例 #2
0
        /// <summary>
        /// </summary>
        public void UpdateSettingsMap()
        {
            // Link control with INI key. Value/Text of control will be automatically tracked and INI file updated.
            // INI setting keys with controls.
            string section = SettingsManager.OptionsSection;

            SettingsManager.AddMap(section, () => SettingName.DebugMode, DebugModeCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Log, EnableLoggingCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Console, ConsoleCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Version, ConfigurationVersionTextBox);
            // Attach property monitoring first.
            var o = SettingsManager.Options;

            SettingsManager.Options.PropertyChanged += Options_PropertyChanged;
            // Stored inside XML now.
            LoadAndMonitor(x => x.GameScanLocations, GameScanLocationsListBox, o.GameScanLocations);
            LoadAndMonitor(x => x.PollingRate, PollingRateComboBox, Enum.GetValues(typeof(UpdateFrequency)));
            LoadAndMonitor(x => x.StartWithWindows, StartWithWindowsCheckBox);
            LoadAndMonitor(x => x.StartWithWindowsState, StartWithWindowsStateComboBox, Enum.GetValues(typeof(FormWindowState)));
            LoadAndMonitor(x => x.InternetDatabaseUrl, InternetDatabaseUrlComboBox, o.InternetDatabaseUrls);
            LoadAndMonitor(x => x.AlwaysOnTop, AlwaysOnTopCheckBox);
            LoadAndMonitor(x => x.AllowOnlyOneCopy, AllowOnlyOneCopyCheckBox);
            LoadAndMonitor(x => x.InternetAutoLoad, InternetAutoLoadCheckBox);
            LoadAndMonitor(x => x.InternetAutoSave, InternetAutoSaveCheckBox);
            LoadAndMonitor(x => x.InternetFeatures, InternetCheckBox);
            LoadAndMonitor(x => x.CheckForUpdates, CheckForUpdatesCheckBox);
            LoadAndMonitor(x => x.RemoteEnabled, RemoteEnabledCheckBox);
            // Load other settings manually.
            LoadSettings();
            // Attach event which will save form settings before Save().
            SettingsManager.OptionsData.Saving += OptionsData_Saving;
        }
コード例 #3
0
        void LoadAndMonitor(Expression <Func <Options, object> > setting, Control control, object dataSource = null)
        {
            var o = SettingsManager.Options;

            SettingsManager.AddMap(setting, control);
            if (dataSource != null)
            {
                // Set ComboBox and attach event last, in order to prevent changing of original value.
                var lc = control as ListControl;
                if (lc != null)
                {
                    lc.DataSource = dataSource;
                }
                var lb = control as ListBox;
                if (lb != null)
                {
                    lb.DataSource = dataSource;
                }
            }
            // Load settings into control.
            o.ReportPropertyChanged(setting);
            // Monitor control changes.
            var chb = control as CheckBox;

            if (chb != null)
            {
                chb.CheckedChanged += Control_Changed;
            }
            var cbx = control as ComboBox;

            if (cbx != null)
            {
                cbx.SelectedIndexChanged += Control_Changed;
            }
        }
コード例 #4
0
        /// <summary>
        /// </summary>
        public void UpdateSettingsMap()
        {
            // Link control with INI key. Value/Text of control will be automatically tracked and INI file updated.
            // INI setting keys with controls.
            string section = SettingsManager.OptionsSection;

            SettingsManager.AddMap(section, () => SettingName.UseInitBeep, UseInitBeepCheckBox);
            SettingsManager.AddMap(section, () => SettingName.DebugMode, DebugModeCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Log, EnableLoggingCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Console, ConsoleCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Version, ConfigurationVersionTextBox);
            SettingsManager.AddMap(section, () => SettingName.CombineEnabled, CombineEnabledCheckBox);
            // Stored inside XML now.
            SettingsManager.AddMap(section, () => SettingName.InternetDatabaseUrl, InternetDatabaseUrlComboBox);
            SettingsManager.AddMap(section, () => SettingName.InternetFeatures, InternetCheckBox);
            SettingsManager.AddMap(section, () => SettingName.InternetAutoLoad, InternetAutoLoadCheckBox);
            SettingsManager.AddMap(section, () => SettingName.InternetAutoSave, InternetAutoSaveCheckBox);
            SettingsManager.AddMap(section, () => SettingName.ProgramScanLocations, GameScanLocationsListBox);
            // Operations.
            SettingsManager.AddMap <Options>(x => x.AlwaysOnTop, AlwaysOnTopCheckBox);
            SettingsManager.AddMap <Options>(x => x.AllowOnlyOneCopy, AllowOnlyOneCopyCheckBox);
            SettingsManager.AddMap <Options>(x => x.StartWithWindows, StartWithWindowsCheckBox);
            SettingsManager.AddMap <Options>(x => x.StartWithWindowsState, StartWithWindowsStateComboBox);
            //SettingsManager.AddMap<Options>(x => x.MinimizeToTray, MinimizeToTrayCheckBox);
            // Load settings into control.
            SettingsManager.Options.PropertyChanged += Options_PropertyChanged;
            // This will trigger Options_PropertyChanged event handler and update controls.
            SettingsManager.Options.ReportPropertyChanged(x => x.AlwaysOnTop);
            SettingsManager.Options.ReportPropertyChanged(x => x.AllowOnlyOneCopy);
            SettingsManager.Options.ReportPropertyChanged(x => x.StartWithWindows);
            SettingsManager.Options.ReportPropertyChanged(x => x.StartWithWindowsState);
            // Monitor control changes.
            AlwaysOnTopCheckBox.CheckedChanged                 += Control_Changed;
            AllowOnlyOneCopyCheckBox.CheckedChanged            += Control_Changed;
            StartWithWindowsCheckBox.CheckedChanged            += Control_Changed;
            StartWithWindowsStateComboBox.SelectedIndexChanged += Control_Changed;
            // Load other settings manually.
            LoadSettings();
            // Attach event which will save form settings before Save().
            SettingsManager.OptionsData.Saving += OptionsData_Saving;
        }
コード例 #5
0
ファイル: OptionsUserControl.cs プロジェクト: kofeve/x360ce
        /// <summary>
        /// </summary>
        public void UpdateSettingsMap()
        {
            // Link control with INI key. Value/Text of control will be automatically tracked and INI file updated.
            // INI setting keys with controls.
            string section = SettingsManager.OptionsSection;

            SettingsManager.AddMap(section, () => SettingName.UseInitBeep, UseInitBeepCheckBox);
            SettingsManager.AddMap(section, () => SettingName.DebugMode, DebugModeCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Log, EnableLoggingCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Console, ConsoleCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Version, ConfigurationVersionTextBox);
            SettingsManager.AddMap(section, () => SettingName.CombineEnabled, CombineEnabledCheckBox);
            // Stored inside XML now.
            SettingsManager.AddMap(section, () => SettingName.InternetDatabaseUrl, InternetDatabaseUrlComboBox);
            SettingsManager.AddMap(section, () => SettingName.InternetFeatures, InternetCheckBox);
            SettingsManager.AddMap(section, () => SettingName.InternetAutoLoad, InternetAutoLoadCheckBox);
            SettingsManager.AddMap(section, () => SettingName.InternetAutoSave, InternetAutoSaveCheckBox);
            SettingsManager.AddMap(section, () => SettingName.AllowOnlyOneCopy, AllowOnlyOneCopyCheckBox);
            SettingsManager.AddMap(section, () => SettingName.ProgramScanLocations, GameScanLocationsListBox);
            LoadSettings();
        }
コード例 #6
0
        /// <summary>
        /// </summary>
        public void UpdateSettingsMap()
        {
            // Link control with INI key. Value/Text of control will be automatically tracked and INI file updated.
            // INI setting keys with controls.
            string section = SettingsManager.OptionsSection;

            SettingsManager.AddMap(section, () => SettingName.DebugMode, DebugModeCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Log, EnableLoggingCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Console, ConsoleCheckBox);
            SettingsManager.AddMap(section, () => SettingName.Version, ConfigurationVersionTextBox);
            // Attach property monitoring first.
            var o = SettingsManager.Options;

            SettingsManager.Options.PropertyChanged += Options_PropertyChanged;
            // Stored inside XML now.
            SettingsManager.AddMap <Options>(x => x.InternetDatabaseUrl, InternetDatabaseUrlComboBox);
            SettingsManager.AddMap <Options>(x => x.PollingRate, PollingRateComboBox);
            SettingsManager.AddMap <Options>(x => x.InternetFeatures, InternetCheckBox);
            SettingsManager.AddMap <Options>(x => x.InternetAutoLoad, InternetAutoLoadCheckBox);
            SettingsManager.AddMap <Options>(x => x.InternetAutoSave, InternetAutoSaveCheckBox);
            SettingsManager.AddMap <Options>(x => x.GameScanLocations, GameScanLocationsListBox);
            SettingsManager.AddMap <Options>(x => x.AlwaysOnTop, AlwaysOnTopCheckBox);
            SettingsManager.AddMap <Options>(x => x.AllowOnlyOneCopy, AllowOnlyOneCopyCheckBox);
            SettingsManager.AddMap <Options>(x => x.StartWithWindows, StartWithWindowsCheckBox);
            SettingsManager.AddMap <Options>(x => x.StartWithWindowsState, StartWithWindowsStateComboBox);
            //SettingsManager.AddMap<Options>(x => x.MinimizeToTray, MinimizeToTrayCheckBox);
            // Load settings into control.
            // This will trigger Options_PropertyChanged event handler and update controls.
            o.ReportPropertyChanged(x => x.InternetFeatures);
            o.ReportPropertyChanged(x => x.InternetAutoLoad);
            o.ReportPropertyChanged(x => x.InternetAutoSave);
            //o.ReportPropertyChanged(x => x.GameScanLocations);
            o.ReportPropertyChanged(x => x.AlwaysOnTop);
            o.ReportPropertyChanged(x => x.AllowOnlyOneCopy);
            // Monitor control changes.

            InternetCheckBox.CheckedChanged         += Control_Changed;
            InternetAutoLoadCheckBox.CheckedChanged += Control_Changed;
            InternetAutoSaveCheckBox.CheckedChanged += Control_Changed;
            AlwaysOnTopCheckBox.CheckedChanged      += Control_Changed;
            AllowOnlyOneCopyCheckBox.CheckedChanged += Control_Changed;
            GameScanLocationsListBox.DataSource      = o.GameScanLocations;
            // Start with windows.
            o.ReportPropertyChanged(x => x.StartWithWindows);
            StartWithWindowsCheckBox.CheckedChanged += Control_Changed;
            // Update start with windows state.
            StartWithWindowsStateComboBox.DataSource = Enum.GetValues(typeof(FormWindowState));
            o.ReportPropertyChanged(x => x.StartWithWindowsState);
            StartWithWindowsStateComboBox.SelectedIndexChanged += Control_Changed;
            // Set ComboBox and attach event last, in order to prevent changing of original value.
            InternetDatabaseUrlComboBox.DataSource = o.InternetDatabaseUrls;
            o.ReportPropertyChanged(x => x.InternetDatabaseUrl);
            InternetDatabaseUrlComboBox.SelectedIndexChanged += Control_Changed;
            // Update pooling rate.
            PollingRateComboBox.DataSource = (UpdateFrequency[])Enum.GetValues(typeof(UpdateFrequency));
            o.ReportPropertyChanged(x => x.PollingRate);
            PollingRateComboBox.SelectedIndexChanged += Control_Changed;
            // Load other settings manually.
            LoadSettings();
            // Attach event which will save form settings before Save().
            SettingsManager.OptionsData.Saving += OptionsData_Saving;
        }