コード例 #1
0
ファイル: Program.cs プロジェクト: yaboy58/BatchGuy
        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);
            }
        }
コード例 #2
0
 protected virtual void OnDialogInitialDirectoryChanged(object sender, DialogInitialDirectoryChangedEventArgs e)
 {
     EventHandler<DialogInitialDirectoryChangedEventArgs> handler = DialogInitialDirectoryChanged;
     if (handler != null)
     {
         handler(this, e);
     }
 }