PowerToys/Plugins/Wox.Plugin.CMD/CMDSetting.xaml.cs
bao-qian b22a4501cc Use variable instead of global static method
1. introduce variable
2. part of #389
3. refactoring program suffix in program plugin
4. 全局变量一时爽,代码重构火葬场
2016-03-28 03:09:57 +01:00

46 lines
1.2 KiB
C#

using System.Windows;
using System.Windows.Controls;
namespace Wox.Plugin.CMD
{
public partial class CMDSetting : UserControl
{
private readonly CMDStorage _settings;
public CMDSetting(CMDStorage settings)
{
InitializeComponent();
_settings = settings;
}
private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
{
cbReplaceWinR.IsChecked = _settings.ReplaceWinR;
cbLeaveCmdOpen.IsChecked = _settings.LeaveCmdOpen;
cbLeaveCmdOpen.Checked += (o, e) =>
{
_settings.LeaveCmdOpen = true;
_settings.Save();
};
cbLeaveCmdOpen.Unchecked += (o, e) =>
{
_settings.LeaveCmdOpen = false;
_settings.Save();
};
cbReplaceWinR.Checked += (o, e) =>
{
_settings.ReplaceWinR = true;
_settings.Save();
};
cbReplaceWinR.Unchecked += (o, e) =>
{
_settings.ReplaceWinR = false;
_settings.Save();
};
}
}
}