close #48 Refactor setting storage.

This commit is contained in:
qianlifeng
2014-03-23 16:17:41 +08:00
parent fc07979966
commit 4ca0453cff
27 changed files with 319 additions and 321 deletions

View File

@@ -11,7 +11,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Wox.Infrastructure;
using Wox.Infrastructure.UserSettings;
using Wox.Infrastructure.Storage;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox
{
@@ -43,9 +44,9 @@ namespace Wox
return;
}
if (CommonStorage.Instance.UserSetting.CustomPluginHotkeys == null)
if (UserSettingStorage.Instance.CustomPluginHotkeys == null)
{
CommonStorage.Instance.UserSetting.CustomPluginHotkeys = new List<CustomPluginHotkey>();
UserSettingStorage.Instance.CustomPluginHotkeys = new List<CustomPluginHotkey>();
}
var pluginHotkey = new CustomPluginHotkey()
@@ -53,7 +54,7 @@ namespace Wox
Hotkey = ctlHotkey.CurrentHotkey.ToString(),
ActionKeyword = tbAction.Text
};
CommonStorage.Instance.UserSetting.CustomPluginHotkeys.Add(pluginHotkey);
UserSettingStorage.Instance.CustomPluginHotkeys.Add(pluginHotkey);
settingWidow.MainWindow.SetHotkey(ctlHotkey.CurrentHotkey.ToString(), delegate
{
settingWidow.MainWindow.ChangeQuery(pluginHotkey.ActionKeyword);
@@ -81,14 +82,14 @@ namespace Wox
MessageBox.Show("Update successfully!");
}
CommonStorage.Instance.Save();
UserSettingStorage.Instance.Save();
settingWidow.ReloadCustomPluginHotkeyView();
Close();
}
public void UpdateItem(CustomPluginHotkey item)
{
updateCustomHotkey = CommonStorage.Instance.UserSetting.CustomPluginHotkeys.FirstOrDefault(o => o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
updateCustomHotkey = UserSettingStorage.Instance.CustomPluginHotkeys.FirstOrDefault(o => o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
if (updateCustomHotkey == null)
{
MessageBox.Show("Invalid plugin hotkey");