mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Rename Wox.Plugin.System to Wox.Plugin.SystemPlugins
Finish moving ProgramSetting into featureBox
This commit is contained in:
@@ -7,7 +7,7 @@ using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Helper;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.System;
|
||||
using Wox.Plugin.SystemPlugins;
|
||||
|
||||
namespace Wox.PluginLoader
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace Wox.PluginLoader
|
||||
metadata.Version = "1.0";
|
||||
metadata.PluginType = PluginType.System;
|
||||
metadata.ActionKeyword = "*";
|
||||
metadata.ExecuteFileName = "Wox.Plugin.System.dll";
|
||||
metadata.ExecuteFileName = "Wox.Plugin.SystemPlugins.dll";
|
||||
metadata.PluginDirecotry = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
|
||||
pluginMetadatas.Add(metadata);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Reflection;
|
||||
using System.Threading;
|
||||
using Wox.Helper;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.System;
|
||||
using Wox.Plugin.SystemPlugins;
|
||||
|
||||
namespace Wox.PluginLoader
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:wox="clr-namespace:Wox"
|
||||
xmlns:UserSettings="clr-namespace:Wox.Infrastructure.Storage.UserSettings;assembly=Wox.Infrastructure" x:Class="Wox.SettingWindow"
|
||||
xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin"
|
||||
xmlns:system="clr-namespace:Wox.Plugin.System;assembly=Wox.Plugin.System"
|
||||
xmlns:system="clr-namespace:Wox.Plugin.SystemPlugins;assembly=Wox.Plugin.SystemPlugins"
|
||||
Icon="Images\app.png"
|
||||
Title="Wox Setting"
|
||||
ResizeMode="NoResize"
|
||||
@@ -219,7 +219,7 @@
|
||||
<TabItem Header="Features">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox x:Name="featureBox" Grid.Column="0" Margin="0" SelectionChanged="featureBox_OnSelectionChanged" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Grid.IsSharedSizeScope="True" >
|
||||
@@ -280,16 +280,30 @@
|
||||
</ListBox>
|
||||
<Grid Margin="0" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80"/>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="58"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ContentControl x:Name="PluginInfoPanel" Grid.ColumnSpan="1" Grid.Row="0" Margin="10 10 10 0">
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="48"></ColumnDefinition>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Width="48" Height="48" HorizontalAlignment="Left" x:Name="pluginIcon"/>
|
||||
<Grid Margin="10,0,0,0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" x:Name="pluginTitle" ToolTip="{Binding Source=pluginTitle, Path=Text}" FontSize="24"></TextBlock>
|
||||
<TextBlock Grid.Row="1" x:Name="pluginSubTitle" Opacity="0.5" ToolTip="{Binding Source=pluginSubTitle, Path=Text}" Visibility="{Binding Source=pluginSubTitle, Path=Text, Converter={wox:StringNullOrEmptyToVisibilityConverter}}" ></TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ContentControl>
|
||||
|
||||
<ContentControl x:Name="PluginContentPanel" Grid.ColumnSpan="1" Grid.Row="1" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Margin="10" Orientation="Vertical">
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="PluginContentPanel" Grid.ColumnSpan="1" Grid.Row="1" Margin="0">
|
||||
|
||||
</StackPanel>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
@@ -14,6 +14,7 @@ using Wox.Infrastructure.Storage;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Plugin;
|
||||
using Wox.Helper;
|
||||
using Wox.Plugin.SystemPlugins;
|
||||
using Application = System.Windows.Forms.Application;
|
||||
using File = System.IO.File;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
@@ -25,6 +26,7 @@ namespace Wox
|
||||
{
|
||||
string woxLinkPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "wox.lnk");
|
||||
public MainWindow MainWindow;
|
||||
private Dictionary<ISettingProvider, Control> featureControls = new Dictionary<ISettingProvider, Control>();
|
||||
|
||||
public SettingWindow()
|
||||
{
|
||||
@@ -164,7 +166,7 @@ namespace Wox
|
||||
Collection =
|
||||
PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System)
|
||||
.Select(o => o.Plugin)
|
||||
.Cast<Wox.Plugin.System.ISystemPlugin>()
|
||||
.Cast<Wox.Plugin.SystemPlugins.ISystemPlugin>()
|
||||
},
|
||||
FindResource("FeatureBoxSeperator"),
|
||||
new CollectionContainer()
|
||||
@@ -453,6 +455,54 @@ namespace Wox
|
||||
|
||||
private void featureBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ISettingProvider provider = null;
|
||||
var pair = featureBox.SelectedItem as PluginPair;
|
||||
if (pair != null)
|
||||
{
|
||||
provider = pair.Plugin as ISettingProvider;
|
||||
pluginTitle.Text = pair.Metadata.Name;
|
||||
pluginSubTitle.Text = pair.Metadata.Description;
|
||||
SyntaxSugars.CallOrRescueDefault(
|
||||
() =>
|
||||
pluginIcon.Source =
|
||||
(ImageSource)
|
||||
new Wox.ImagePathConverter().Convert(
|
||||
new object[] {pair.Metadata.IcoPath, pair.Metadata.PluginDirecotry}, null, null,
|
||||
null));
|
||||
}
|
||||
else
|
||||
{
|
||||
provider = featureBox.SelectedItem as ISettingProvider;
|
||||
|
||||
var sys = featureBox.SelectedItem as BaseSystemPlugin;
|
||||
if (sys != null)
|
||||
{
|
||||
pluginTitle.Text = sys.Name;
|
||||
pluginSubTitle.Text = sys.Description;
|
||||
SyntaxSugars.CallOrRescueDefault(
|
||||
() =>
|
||||
pluginIcon.Source =
|
||||
(ImageSource)
|
||||
new Wox.ImagePathConverter().Convert(
|
||||
new object[] { sys.IcoPath, sys.PluginDirectory }, null, null,
|
||||
null));
|
||||
}
|
||||
}
|
||||
|
||||
this.PluginContentPanel.Content = null;
|
||||
if (provider != null)
|
||||
{
|
||||
Control control = null;
|
||||
if (!featureControls.TryGetValue(provider, out control))
|
||||
featureControls.Add(provider, control = provider.CreateSettingPanel());
|
||||
|
||||
PluginContentPanel.Content = control;
|
||||
control.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||
control.VerticalAlignment = VerticalAlignment.Stretch;
|
||||
control.Width = Double.NaN;
|
||||
control.Height = Double.NaN;
|
||||
}
|
||||
// featureControls
|
||||
// throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,9 +266,9 @@
|
||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||
<Name>Wox.Infrastructure</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Wox.Plugin.System\Wox.Plugin.System.csproj">
|
||||
<ProjectReference Include="..\Wox.Plugin.SystemPlugins\Wox.Plugin.SystemPlugins.csproj">
|
||||
<Project>{69ce0206-cb41-453d-88af-df86092ef9b8}</Project>
|
||||
<Name>Wox.Plugin.System</Name>
|
||||
<Name>Wox.Plugin.SystemPlugins</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Wox.Plugin\Wox.Plugin.csproj">
|
||||
<Project>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</Project>
|
||||
|
||||
Reference in New Issue
Block a user