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

View File

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