public async Task EditButtonClicked() { if (Level == ApplicationControlLevel.Directory) { var directory = gridViewDirectories.GetRow(gridViewDirectories.FocusedRowHandle) as SettingsDirectory; if (directory == null) { return; } SettingsDirectory ediDirectory = new SettingsDirectory { Name = directory.Name, Description = directory.Description }; DirectoryEditForm form = new DirectoryEditForm(ediDirectory, applicationName); if (form.ShowDialog() == DialogResult.OK) { try { OnShowProgress(); if (await settingsManager.UpdateDirectoryAsync(Application.Name, directory.Name, ediDirectory.Name, ediDirectory.Description)) { directory.Name = ediDirectory.Name; directory.Description = ediDirectory.Description; await RefreshButtonClicked(); } } finally { OnHideProgress(); } } } else { var setting = gridViewSettings.GetRow(gridViewSettings.FocusedRowHandle) as Setting; if (setting != null) { SettingEditForm form = new SettingEditForm(setting, currentDirectory); if (form.ShowDialog() == DialogResult.OK) { try { OnShowProgress(); await currentDirectory.SaveAsync(form.Setting); await RefreshButtonClicked(); } finally { OnHideProgress(); } } } } }
public async Task NewItemButtonClicked() { if (Level == ApplicationControlLevel.Directory) { DirectoryEditForm form = new DirectoryEditForm(null, applicationName); if (form.ShowDialog() == DialogResult.OK) { try { OnShowProgress(); var newDirectory = form.Directory; if (await settingsManager.CreateDirectoryAsync(Application.Name, newDirectory.Name, newDirectory.Description)) { directoryBinding.Add(newDirectory); } } finally { OnHideProgress(); } } } else { SettingEditForm form = new SettingEditForm(null, currentDirectory); if (form.ShowDialog() == DialogResult.OK) { try { OnShowProgress(); await currentDirectory.SaveAsync(form.Setting); await OpenSettings(); } finally { OnHideProgress(); } } } }
public async Task EditButtonClicked() { if (Level == ApplicationControlLevel.Directory) { var directory = gridViewDirectories.GetRow(gridViewDirectories.FocusedRowHandle) as SettingsDirectory; if (directory == null) return; SettingsDirectory ediDirectory = new SettingsDirectory { Name = directory.Name, Description = directory.Description }; DirectoryEditForm form = new DirectoryEditForm(ediDirectory, applicationName); if (form.ShowDialog() == DialogResult.OK) { try { OnShowProgress(); if (await settingsManager.UpdateDirectoryAsync(Application.Name, directory.Name, ediDirectory.Name, ediDirectory.Description)) { directory.Name = ediDirectory.Name; directory.Description = ediDirectory.Description; await RefreshButtonClicked(); } } finally { OnHideProgress(); } } } else { var setting = gridViewSettings.GetRow(gridViewSettings.FocusedRowHandle) as Setting; if (setting != null) { SettingEditForm form = new SettingEditForm(setting, currentDirectory); if (form.ShowDialog() == DialogResult.OK) { try { OnShowProgress(); await currentDirectory.SaveAsync(form.Setting); await RefreshButtonClicked(); } finally { OnHideProgress(); } } } } }