Exemple #1
0
        public static void DialogInitialDirectoryChangedHandler(object sender, DialogInitialDirectoryChangedEventArgs e)
        {
            try
            {
                Setting setting = Program.ApplicationSettingsService.GetSettingByName(e.FeatureName);

                if (setting != null)
                {
                    if (setting.Value != e.DirectoryPath)
                    {
                        setting.Value = e.DirectoryPath;
                        Program.ApplicationSettingsService.Save(Program.ApplicationSettings);
                    }
                }
                else
                {
                    Program.ApplicationSettings.Settings.Add(new Setting() { Name = e.FeatureName, Value = e.DirectoryPath });
                    Program.ApplicationSettingsService.Save(Program.ApplicationSettings);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was an error trying to set the initial directory", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _loggingService.LogErrorFormat(ex, MethodBase.GetCurrentMethod().Name);
            }
        }
 protected virtual void OnDialogInitialDirectoryChanged(object sender, DialogInitialDirectoryChangedEventArgs e)
 {
     EventHandler<DialogInitialDirectoryChangedEventArgs> handler = DialogInitialDirectoryChanged;
     if (handler != null)
     {
         handler(this, e);
     }
 }