Example #1
0
 private static void SetSavedPreferencesToPreferenceForm(PreferenceForm form)
 {
     form.LoggingType      = Properties.Settings.Default.LoggerPreference;
     form.ConnectionString =
         !string.IsNullOrEmpty(Properties.Settings.Default.ConnectionString)
             ? Properties.Settings.Default.ConnectionString
             : ConfigurationManager.ConnectionStrings["logConnection"].ConnectionString;
     form.LogDirectories = Properties.Settings.Default.LogDirectories;
 }
Example #2
0
 private void SaveUserPreferences(PreferenceForm form)
 {
     Properties.Settings.Default.LoggerPreference = form.LoggingType;
     Properties.Settings.Default.LogDirectories   = form.LogDirectories;
     if (form.LoggingType == LoggingType.SqlLogger)
     {
         Properties.Settings.Default.ConnectionString = form.ConnectionString;
     }
     Properties.Settings.Default.Save();
 }
Example #3
0
        private void miFilePreferences_Click(object sender, EventArgs e)
        {
            using (var preferenceForm = new PreferenceForm())
            {
                SetSavedPreferencesToPreferenceForm(preferenceForm);

                if (preferenceForm.ShowDialog(this) == DialogResult.OK)
                {
                    UpdateModelFromPreferenceForm(preferenceForm);
                    SaveUserPreferences(preferenceForm);
                    SetModelLogger();
                }
            }
        }
Example #4
0
 private void UpdateModelFromPreferenceForm(PreferenceForm form)
 {
     _model.LoggingType      = form.LoggingType;
     _model.LogDirectories   = form.LogDirectories;
     _model.ConnectionString = form.ConnectionString;
 }