This commit is contained in:
qianlifeng
2014-03-19 22:17:19 +08:00
15 changed files with 347 additions and 12 deletions

View File

@@ -114,13 +114,14 @@ namespace Wox
foreach (string theme in LoadAvailableThemes())
{
string themeName = theme.Substring(theme.LastIndexOf('\\') + 1).Replace(".xaml", "");
string themeName = System.IO.Path.GetFileNameWithoutExtension(theme);
themeComboBox.Items.Add(themeName);
}
themeComboBox.SelectedItem = CommonStorage.Instance.UserSetting.Theme;
cbReplaceWinR.IsChecked = CommonStorage.Instance.UserSetting.ReplaceWinR;
webSearchView.ItemsSource = CommonStorage.Instance.UserSetting.WebSearches;
programSourceView.ItemsSource = CommonStorage.Instance.UserSetting.ProgramSources;
lvCustomHotkey.ItemsSource = CommonStorage.Instance.UserSetting.CustomPluginHotkeys;
cbEnablePythonPlugins.IsChecked = CommonStorage.Instance.UserSetting.EnablePythonPlugins;
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
@@ -131,6 +132,11 @@ namespace Wox
webSearchView.Items.Refresh();
}
public void ReloadProgramSourceView()
{
programSourceView.Items.Refresh();
}
private List<string> LoadAvailableThemes()
{
string themePath = Directory.GetCurrentDirectory() + "\\Themes\\";
@@ -176,6 +182,43 @@ namespace Wox
}
}
private void btnAddProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSourceSetting programSource = new ProgramSourceSetting(this);
programSource.ShowDialog();
}
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)
{
CommonStorage.Instance.UserSetting.ProgramSources.Remove(seletedProgramSource);
programSourceView.Items.Refresh();
}
else
{
MessageBox.Show("Please select a program source");
}
}
private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (seletedProgramSource != null)
{
ProgramSourceSetting programSource = new ProgramSourceSetting(this);
programSource.UpdateItem(seletedProgramSource);
programSource.ShowDialog();
}
else
{
MessageBox.Show("Please select a program source");
}
}
private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e)
{
CreateStartupFolderShortcut();