mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-07 20:07:56 +08:00
Move CMD settings to CMD plugin details.
This commit is contained in:
parent
0c75cf6055
commit
f01de3a69d
@ -4,10 +4,11 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Control = System.Windows.Controls.Control;
|
||||||
|
|
||||||
namespace Wox.Plugin.SystemPlugins.CMD
|
namespace Wox.Plugin.SystemPlugins.CMD
|
||||||
{
|
{
|
||||||
public class CMD : BaseSystemPlugin
|
public class CMD : BaseSystemPlugin,ISettingProvider
|
||||||
{
|
{
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
|
|
||||||
@ -167,5 +168,10 @@ namespace Wox.Plugin.SystemPlugins.CMD
|
|||||||
{
|
{
|
||||||
get { return "Provide executing commands from Wox. Commands should start with >"; }
|
get { return "Provide executing commands from Wox. Commands should start with >"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Control CreateSettingPanel()
|
||||||
|
{
|
||||||
|
return new CMDSetting();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml
Normal file
25
Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<UserControl x:Class="Wox.Plugin.SystemPlugins.CMD.CMDSetting"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Loaded="CMDSetting_OnLoaded"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Border BorderBrush="Gray" Margin="10" BorderThickness="1">
|
||||||
|
<Grid Margin="10" VerticalAlignment="Top" >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||||
|
<CheckBox x:Name="cbReplaceWinR" />
|
||||||
|
<TextBlock Text="Replace Win+R" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0 10 0 0">
|
||||||
|
<CheckBox x:Name="cbLeaveCmdOpen" />
|
||||||
|
<TextBlock Text="Do not close Command Prompt after command execution" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
54
Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml.cs
Normal file
54
Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using Wox.Infrastructure.Storage.UserSettings;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.SystemPlugins.CMD
|
||||||
|
{
|
||||||
|
public partial class CMDSetting : UserControl
|
||||||
|
{
|
||||||
|
public CMDSetting()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
|
||||||
|
{
|
||||||
|
cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR;
|
||||||
|
cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen;
|
||||||
|
|
||||||
|
cbLeaveCmdOpen.Checked += (o, e) =>
|
||||||
|
{
|
||||||
|
UserSettingStorage.Instance.LeaveCmdOpen = true;
|
||||||
|
UserSettingStorage.Instance.Save();
|
||||||
|
};
|
||||||
|
|
||||||
|
cbLeaveCmdOpen.Unchecked += (o, e) =>
|
||||||
|
{
|
||||||
|
UserSettingStorage.Instance.LeaveCmdOpen = false;
|
||||||
|
UserSettingStorage.Instance.Save();
|
||||||
|
};
|
||||||
|
|
||||||
|
cbReplaceWinR.Checked += (o, e) =>
|
||||||
|
{
|
||||||
|
UserSettingStorage.Instance.ReplaceWinR = true;
|
||||||
|
UserSettingStorage.Instance.Save();
|
||||||
|
};
|
||||||
|
cbReplaceWinR.Unchecked += (o, e) =>
|
||||||
|
{
|
||||||
|
UserSettingStorage.Instance.ReplaceWinR = false;
|
||||||
|
UserSettingStorage.Instance.Save();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -54,6 +54,9 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="CMD\CMDSetting.xaml.cs">
|
||||||
|
<DependentUpon>CMDSetting.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="CMD\CMDStorage.cs" />
|
<Compile Include="CMD\CMDStorage.cs" />
|
||||||
<Compile Include="ColorsPlugin.cs" />
|
<Compile Include="ColorsPlugin.cs" />
|
||||||
<Compile Include="Folder\FolderPluginSettings.xaml.cs">
|
<Compile Include="Folder\FolderPluginSettings.xaml.cs">
|
||||||
@ -102,6 +105,10 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Include="CMD\CMDSetting.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Folder\FolderPluginSettings.xaml">
|
<Page Include="Folder\FolderPluginSettings.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -26,14 +26,6 @@
|
|||||||
<CheckBox x:Name="cbStartWithWindows" Unchecked="CbStartWithWindows_OnUnchecked" Checked="CbStartWithWindows_OnChecked" />
|
<CheckBox x:Name="cbStartWithWindows" Unchecked="CbStartWithWindows_OnUnchecked" Checked="CbStartWithWindows_OnChecked" />
|
||||||
<TextBlock Text="Start Wox on system startup" />
|
<TextBlock Text="Start Wox on system startup" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Margin="10">
|
|
||||||
<CheckBox x:Name="cbReplaceWinR" />
|
|
||||||
<TextBlock Text="Replace Win+R" />
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="10">
|
|
||||||
<CheckBox x:Name="cbLeaveCmdOpen" />
|
|
||||||
<TextBlock Text="Do not close Command Prompt after command execution" />
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="10">
|
<StackPanel Orientation="Horizontal" Margin="10">
|
||||||
<CheckBox x:Name="cbHideWhenDeactive" />
|
<CheckBox x:Name="cbHideWhenDeactive" />
|
||||||
<TextBlock Text="Hide Wox when loses focus" />
|
<TextBlock Text="Hide Wox when loses focus" />
|
||||||
|
@ -48,27 +48,6 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged;
|
ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged;
|
||||||
ctlHotkey.SetHotkey(UserSettingStorage.Instance.Hotkey, false);
|
ctlHotkey.SetHotkey(UserSettingStorage.Instance.Hotkey, false);
|
||||||
cbReplaceWinR.Checked += (o, e) =>
|
|
||||||
{
|
|
||||||
UserSettingStorage.Instance.ReplaceWinR = true;
|
|
||||||
UserSettingStorage.Instance.Save();
|
|
||||||
};
|
|
||||||
cbReplaceWinR.Unchecked += (o, e) =>
|
|
||||||
{
|
|
||||||
UserSettingStorage.Instance.ReplaceWinR = false;
|
|
||||||
UserSettingStorage.Instance.Save();
|
|
||||||
};
|
|
||||||
|
|
||||||
cbLeaveCmdOpen.Checked += (o, e) => {
|
|
||||||
UserSettingStorage.Instance.LeaveCmdOpen = true;
|
|
||||||
UserSettingStorage.Instance.Save();
|
|
||||||
};
|
|
||||||
|
|
||||||
cbLeaveCmdOpen.Unchecked += (o, e) =>
|
|
||||||
{
|
|
||||||
UserSettingStorage.Instance.LeaveCmdOpen = false;
|
|
||||||
UserSettingStorage.Instance.Save();
|
|
||||||
};
|
|
||||||
|
|
||||||
cbHideWhenDeactive.Checked += (o, e) =>
|
cbHideWhenDeactive.Checked += (o, e) =>
|
||||||
{
|
{
|
||||||
@ -82,10 +61,8 @@ namespace Wox
|
|||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
};
|
};
|
||||||
|
|
||||||
cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR;
|
|
||||||
lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;
|
lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;
|
||||||
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
||||||
cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen;
|
|
||||||
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
|
cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
|
||||||
|
|
||||||
#region Load Theme
|
#region Load Theme
|
||||||
|
Loading…
Reference in New Issue
Block a user