Merge pull request #105 from CoenraadS/master

[WebSearch/Programs] Fix MessageBox behaviour
This commit is contained in:
qianlifeng 2014-07-10 23:58:27 +08:00
commit 4436a72b9f
2 changed files with 22 additions and 18 deletions

View File

@ -34,13 +34,15 @@ namespace Wox.Plugin.SystemPlugins.Program
private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (seletedProgramSource != null &&
MessageBox.Show("Are your sure to delete " + seletedProgramSource.ToString(), "Delete ProgramSource",
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (selectedProgramSource != null)
{
UserSettingStorage.Instance.ProgramSources.Remove(seletedProgramSource);
programSourceView.Items.Refresh();
if (MessageBox.Show("Are your sure to delete " + selectedProgramSource.ToString(), "Delete ProgramSource",
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
UserSettingStorage.Instance.ProgramSources.Remove(selectedProgramSource);
programSourceView.Items.Refresh();
}
}
else
{
@ -50,11 +52,11 @@ namespace Wox.Plugin.SystemPlugins.Program
private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (seletedProgramSource != null)
ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (selectedProgramSource != null)
{
ProgramSourceSetting programSource = new ProgramSourceSetting(this);
programSource.UpdateItem(seletedProgramSource);
programSource.UpdateItem(selectedProgramSource);
programSource.ShowDialog();
}
else

View File

@ -35,13 +35,15 @@ namespace Wox.Plugin.SystemPlugins
private void btnDeleteWebSearch_OnClick(object sender, RoutedEventArgs e)
{
WebSearch seletedWebSearch = webSearchView.SelectedItem as WebSearch;
if (seletedWebSearch != null &&
MessageBox.Show("Are your sure to delete " + seletedWebSearch.Title, "Delete WebSearch",
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
WebSearch selectedWebSearch = webSearchView.SelectedItem as WebSearch;
if (selectedWebSearch != null)
{
UserSettingStorage.Instance.WebSearches.Remove(seletedWebSearch);
webSearchView.Items.Refresh();
if (MessageBox.Show("Are your sure to delete " + selectedWebSearch.Title, "Delete WebSearch",
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
UserSettingStorage.Instance.WebSearches.Remove(selectedWebSearch);
webSearchView.Items.Refresh();
}
}
else
{
@ -51,11 +53,11 @@ namespace Wox.Plugin.SystemPlugins
private void btnEditWebSearch_OnClick(object sender, RoutedEventArgs e)
{
WebSearch seletedWebSearch = webSearchView.SelectedItem as WebSearch;
if (seletedWebSearch != null)
WebSearch selectedWebSearch = webSearchView.SelectedItem as WebSearch;
if (selectedWebSearch != null)
{
WebSearchSetting webSearch = new WebSearchSetting(this);
webSearch.UpdateItem(seletedWebSearch);
webSearch.UpdateItem(selectedWebSearch);
webSearch.ShowDialog();
}
else