Rename Wox.Plugin.System to Wox.Plugin.SystemPlugins

Finish moving ProgramSetting into featureBox
This commit is contained in:
Yeechan Lu 2014-03-29 15:52:57 +08:00
parent 479945455b
commit 80ec16b9bd
35 changed files with 142 additions and 51 deletions

View File

@ -8,7 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugin", "Plugin", "{3A73F5
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox", "Wox\Wox.csproj", "{DB90F671-D861-46BB-93A3-F1304F5BA1C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.System", "Wox.Plugin.System\Wox.Plugin.System.csproj", "{69CE0206-CB41-453D-88AF-DF86092EF9B8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.SystemPlugins", "Wox.Plugin.SystemPlugins\Wox.Plugin.SystemPlugins.csproj", "{69CE0206-CB41-453D-88AF-DF86092EF9B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Runtime", "Pythonnet.Runtime\Python.Runtime.csproj", "{097B4AC0-74E9-4C58-BCF8-C69746EC8271}"
EndProject

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public abstract class BaseSystemPlugin :ISystemPlugin
{

View File

@ -10,7 +10,7 @@ using System.Windows.Forms;
using Newtonsoft.Json;
using Wox.Infrastructure;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public class BrowserBookmarks : BaseSystemPlugin
{

View File

@ -5,7 +5,7 @@ using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
namespace Wox.Plugin.System.CMD
namespace Wox.Plugin.SystemPlugins.CMD
{
public class CMD : BaseSystemPlugin
{

View File

@ -5,7 +5,7 @@ using System.Text;
using Newtonsoft.Json;
using Wox.Infrastructure.Storage;
namespace Wox.Plugin.System.CMD
namespace Wox.Plugin.SystemPlugins.CMD
{
public class CMDStorage : BaseStorage<CMDStorage>
{

View File

@ -8,7 +8,7 @@ using System.Text.RegularExpressions;
using System.Windows.Forms;
using YAMP;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public class Calculator : BaseSystemPlugin
{

View File

@ -7,7 +7,7 @@ using System.Text;
using System.Windows.Forms;
using Wox.Infrastructure;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public class DirectoryIndicator : BaseSystemPlugin
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Diagnostics;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public interface IProgramSource
{

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public interface ISystemPlugin : IPlugin
{

View File

@ -1,4 +1,4 @@
<UserControl x:Class="Wox.Plugin.System.ProgramSetting"
<UserControl x:Class="Wox.Plugin.SystemPlugins.ProgramSetting"
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"

View File

@ -13,7 +13,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
/// <summary>
/// Interaction logic for ProgramSetting.xaml

View File

@ -1,7 +1,6 @@
<Window x:Class="Wox.Plugin.System.ProgramSourceSetting"
<Window x:Class="Wox.Plugin.SystemPlugins.ProgramSourceSetting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Icon="Images\app.png"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Title="ProgramSourceSetting" Height="350" Width="674.766">

View File

@ -17,7 +17,7 @@ using Wox.Infrastructure.Storage;
using Wox.Infrastructure.Storage.UserSettings;
using MessageBox = System.Windows.MessageBox;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public partial class ProgramSourceSetting : Window
{
@ -30,7 +30,7 @@ namespace Wox.Plugin.System
this.settingWindow = settingWidow;
InitializeComponent();
this.cbType.ItemsSource = Wox.Plugin.System.Programs.SourceTypes.Select(o => o.Key).ToList();
this.cbType.ItemsSource = Wox.Plugin.SystemPlugins.Programs.SourceTypes.Select(o => o.Key).ToList();
}
public void UpdateItem(ProgramSource programSource)
@ -115,7 +115,7 @@ namespace Wox.Plugin.System
{
string item = cbType.SelectedItem as String;
Type type;
if (item != null && Wox.Plugin.System.Programs.SourceTypes.TryGetValue(item, out type))
if (item != null && Wox.Plugin.SystemPlugins.Programs.SourceTypes.TryGetValue(item, out type))
{
var attrs = type.GetCustomAttributes(typeof(BrowsableAttribute), false);
if (attrs.Length > 0 && (attrs[0] as BrowsableAttribute).Browsable == false)

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.System.ProgramSources
namespace Wox.Plugin.SystemPlugins.ProgramSources
{
[global::System.ComponentModel.Browsable(false)]
public class AppPathsProgramSource: AbstractProgramSource

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Runtime.InteropServices;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.System.ProgramSources
namespace Wox.Plugin.SystemPlugins.ProgramSources
{
[global::System.ComponentModel.Browsable(false)]
public class CommonStartMenuProgramSource : FileSystemProgramSource

View File

@ -5,7 +5,7 @@ using System.Text;
using System.IO;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.System.ProgramSources
namespace Wox.Plugin.SystemPlugins.ProgramSources
{
public class FileSystemProgramSource : AbstractProgramSource
{

View File

@ -6,7 +6,7 @@ using System.IO;
using IniParser;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.System.ProgramSources
namespace Wox.Plugin.SystemPlugins.ProgramSources
{
public class PortableAppsProgramSource : AbstractProgramSource
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.System.ProgramSources
namespace Wox.Plugin.SystemPlugins.ProgramSources
{
[global::System.ComponentModel.Browsable(false)]
public class UserStartMenuProgramSource : FileSystemProgramSource

View File

@ -11,9 +11,9 @@ using Microsoft.Win32;
using Wox.Infrastructure;
using Wox.Infrastructure.Storage;
using Wox.Infrastructure.Storage.UserSettings;
using Wox.Plugin.System.ProgramSources;
using Wox.Plugin.SystemPlugins.ProgramSources;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public class Program
{
@ -43,7 +43,7 @@ namespace Wox.Plugin.System
public IProgramSource Source { get; set; }
}
public class Programs : BaseSystemPlugin
public class Programs : BaseSystemPlugin, ISettingProvider
{
List<Program> installedList = new List<Program>();
List<IProgramSource> sources = new List<IProgramSource>();
@ -161,5 +161,14 @@ namespace Wox.Plugin.System
{
get { return base.Description; }
}
#region ISettingProvider Members
public System.Windows.Controls.Control CreateSettingPanel()
{
return new ProgramSetting();
}
#endregion
}
}

View File

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Wox.Plugin.System")]
[assembly: AssemblyTitle("Wox.Plugin.SystemPlugins")]
[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox.Plugin.System")]
[assembly: AssemblyProduct("Wox.Plugin.SystemPlugins")]
[assembly: AssemblyCopyright("The MIT License (MIT)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -10,7 +10,7 @@ using Newtonsoft.Json.Serialization;
using Wox.Infrastructure;
using YAMP.Numerics;
namespace Wox.Plugin.System.SuggestionSources
namespace Wox.Plugin.SystemPlugins.SuggestionSources
{
public class Google : AbstractSuggestionSource
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace Wox.Plugin.System.SuggestionSources
namespace Wox.Plugin.SystemPlugins.SuggestionSources
{
public interface ISuggestionSource
{

View File

@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public class Sys : BaseSystemPlugin
{

View File

@ -6,7 +6,7 @@ using Wox.Infrastructure;
using Wox.Infrastructure.Storage;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public class ThirdpartyPluginIndicator : BaseSystemPlugin
{

View File

@ -7,9 +7,9 @@ using Newtonsoft.Json;
using Wox.Infrastructure;
using Wox.Infrastructure.Storage;
using Wox.Infrastructure.Storage.UserSettings;
using Wox.Plugin.System.SuggestionSources;
using Wox.Plugin.SystemPlugins.SuggestionSources;
namespace Wox.Plugin.System
namespace Wox.Plugin.SystemPlugins
{
public class WebSearchPlugin : BaseSystemPlugin
{

View File

@ -7,8 +7,8 @@
<ProjectGuid>{69CE0206-CB41-453D-88AF-DF86092EF9B8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.System</RootNamespace>
<AssemblyName>Wox.Plugin.System</AssemblyName>
<RootNamespace>Wox.Plugin.SystemPlugins</RootNamespace>
<AssemblyName>Wox.Plugin.SystemPlugins</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
namespace Wox.Plugin
{
public interface ISettingProvider
{
Control CreateSettingPanel();
}
}

View File

@ -31,16 +31,22 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="AllowedLanguage.cs" />
<Compile Include="IPlugin.cs" />
<Compile Include="ISettingProvider.cs" />
<Compile Include="PluginPair.cs" />
<Compile Include="PluginInitContext.cs" />
<Compile Include="PluginMetadata.cs" />

View File

@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugin", "Plugin", "{3A73F5
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox", "Wox\Wox.csproj", "{DB90F671-D861-46BB-93A3-F1304F5BA1C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.System", "Wox.Plugin.System\Wox.Plugin.System.csproj", "{69CE0206-CB41-453D-88AF-DF86092EF9B8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.SystemPlugins", "Wox.Plugin.SystemPlugins\Wox.Plugin.SystemPlugins.csproj", "{69CE0206-CB41-453D-88AF-DF86092EF9B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Runtime", "Pythonnet.Runtime\Python.Runtime.csproj", "{097B4AC0-74E9-4C58-BCF8-C69746EC8271}"
EndProject

View File

@ -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);
}

View File

@ -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
{

View File

@ -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>

View File

@ -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();
}
}

View File

@ -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>