Remove instance logic for BinaryStorage and JsonStorage, part 1

1. part of #389
2. huge refactoring
This commit is contained in:
bao-qian
2016-04-21 01:53:21 +01:00
parent 0bcb76fa81
commit 8d10c9aa41
52 changed files with 502 additions and 584 deletions

View File

@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Wox.Infrastructure.Storage;
namespace Wox.Plugin.Folder
{
@@ -12,7 +13,20 @@ namespace Wox.Plugin.Folder
{
private static List<string> driverNames;
private PluginInitContext context;
private FolderStorage _settings = FolderStorage.Instance;
private readonly Settings _settings;
private readonly PluginSettingsStorage<Settings> _storage;
public FolderPlugin()
{
_storage = new PluginSettingsStorage<Settings>();
_settings = _storage.Load();
}
~FolderPlugin()
{
_storage.Save();
}
public Control CreateSettingPanel()
{
@@ -26,7 +40,6 @@ namespace Wox.Plugin.Folder
if (_settings.FolderLinks == null)
{
_settings.FolderLinks = new List<FolderLink>();
_settings.Save();
}
}