2014-01-25 10:00:13 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
2014-01-29 10:33:24 +00:00
|
|
|
|
using Wox.Helper;
|
2014-01-25 10:00:13 +00:00
|
|
|
|
|
2014-01-29 10:33:24 +00:00
|
|
|
|
namespace Wox
|
2014-01-25 10:00:13 +00:00
|
|
|
|
{
|
|
|
|
|
public partial class SettingWidow : Window
|
|
|
|
|
{
|
|
|
|
|
private MainWindow mainWindow;
|
|
|
|
|
|
|
|
|
|
public SettingWidow(MainWindow mainWindow)
|
|
|
|
|
{
|
|
|
|
|
this.mainWindow = mainWindow;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
Loaded += Setting_Loaded;
|
2014-01-25 16:37:15 +00:00
|
|
|
|
cbReplaceWinR.Checked += (o, e) =>
|
|
|
|
|
{
|
2014-01-28 03:19:27 +00:00
|
|
|
|
CommonStorage.Instance.UserSetting.ReplaceWinR = true;
|
|
|
|
|
CommonStorage.Instance.Save();
|
2014-01-25 16:37:15 +00:00
|
|
|
|
};
|
|
|
|
|
cbReplaceWinR.Unchecked += (o, e) =>
|
|
|
|
|
{
|
2014-01-28 03:19:27 +00:00
|
|
|
|
CommonStorage.Instance.UserSetting.ReplaceWinR = false;
|
|
|
|
|
CommonStorage.Instance.Save();
|
2014-01-25 16:37:15 +00:00
|
|
|
|
};
|
2014-01-25 10:00:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Setting_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
foreach (string theme in LoadAvailableThemes())
|
|
|
|
|
{
|
|
|
|
|
string themeName = theme.Substring(theme.LastIndexOf('\\') + 1).Replace(".xaml", "");
|
|
|
|
|
themeComboBox.Items.Add(themeName);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-28 03:19:27 +00:00
|
|
|
|
themeComboBox.SelectedItem = CommonStorage.Instance.UserSetting.Theme;
|
|
|
|
|
cbReplaceWinR.IsChecked = CommonStorage.Instance.UserSetting.ReplaceWinR;
|
2014-01-25 10:00:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<string> LoadAvailableThemes()
|
|
|
|
|
{
|
|
|
|
|
string themePath = Directory.GetCurrentDirectory() + "\\Themes\\";
|
|
|
|
|
return Directory.GetFiles(themePath).Where(filePath => filePath.EndsWith(".xaml")).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string themeName = themeComboBox.SelectedItem.ToString();
|
2014-01-28 03:19:27 +00:00
|
|
|
|
mainWindow.SetTheme(themeName);
|
|
|
|
|
CommonStorage.Instance.UserSetting.Theme = themeName;
|
|
|
|
|
CommonStorage.Instance.Save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
WebSearchSetting webSearch = new WebSearchSetting();
|
|
|
|
|
webSearch.Show();
|
2014-01-25 10:00:13 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|