Пример #1
0
        private void SettingsForm_Load(object sender, EventArgs e)
        {
            try
            {
                comboBoxLogLevel.Items.Add(LogType.None.ToString());
                comboBoxLogLevel.Items.Add(LogType.All.ToString());
                comboBoxLogLevel.Items.Add(LogType.Warning.ToString());
                comboBoxLogLevel.Items.Add(LogType.Error.ToString());
                comboBoxLogLevel.Items.Add(LogType.Performance.ToString());

                ComboBoxItem.AddItem(comboBoxFileReturnType,
                                     "Filter Google Files (Recommended)",
                                     FileReturnType.FilterGoogleFiles);
                ComboBoxItem.AddItem(comboBoxFileReturnType,
                                     "Ignore Google Files (Possible slow performance)",
                                     FileReturnType.IgnoreGoogleFiles);
                ComboBoxItem.AddItem(comboBoxFileReturnType,
                                     "Return All Google Files (Not recommended)",
                                     FileReturnType.ReturnAllGoogleFiles);

                comboBoxLogLevel.SelectedItem = DriveService.Settings.LogLevel.ToString();
                ComboBoxItem.SetSelectedItem(comboBoxFileReturnType, DriveService.Settings.FileReturnType);
                checkBoxUseCaching.Checked = DriveService.Settings.UseCaching;
                checkBoxStartup.Checked    = DriveService.Settings.IsStartingStartOnStartup;
            }
            catch (Exception exception)
            {
                Log.Error(exception, false);

                MessageBox.Show(this, exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void SettingsForm_Load(object sender, EventArgs e)
        {
            try
            {
                lstLogTypes.SetItemCheckState(0,
                                              (DriveService.Settings.LogLevel & LogType.Error) == 0
                                        ? CheckState.Unchecked
                                        : CheckState.Checked);

                lstLogTypes.SetItemCheckState(1,
                                              (DriveService.Settings.LogLevel & LogType.Warning) == 0
                                        ? CheckState.Unchecked
                                        : CheckState.Checked);

                lstLogTypes.SetItemCheckState(2,
                                              (DriveService.Settings.LogLevel & LogType.Information) == 0
                                        ? CheckState.Unchecked
                                        : CheckState.Checked);

                lstLogTypes.SetItemCheckState(3,
                                              (DriveService.Settings.LogLevel & LogType.Debug) == 0
                                        ? CheckState.Unchecked
                                        : CheckState.Checked);

                lstLogTypes.SetItemCheckState(4,
                                              (DriveService.Settings.LogLevel & LogType.Performance) == 0
                                        ? CheckState.Unchecked
                                        : CheckState.Checked);

                ComboBoxItem.AddItem(comboBoxFileReturnType,
                                     "Filter Google Files (Recommended)",
                                     FileReturnType.FilterGoogleFiles);
                ComboBoxItem.AddItem(comboBoxFileReturnType,
                                     "Ignore Google Files (Possible slow performance)",
                                     FileReturnType.IgnoreGoogleFiles);
                ComboBoxItem.AddItem(comboBoxFileReturnType,
                                     "Return All Google Files (Not recommended)",
                                     FileReturnType.ReturnAllGoogleFiles);

                ComboBoxItem.SetSelectedItem(comboBoxFileReturnType, DriveService.Settings.FileReturnType);
                checkBoxUseCaching.Checked = DriveService.Settings.UseCaching;
                checkBoxStartup.Checked    = DriveService.Settings.IsStartingStartOnStartup;
            }
            catch (Exception exception)
            {
                Log.Error(exception, false);

                MessageBox.Show(this, exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }