mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
close #48 Refactor setting storage.
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user