mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Refactoring Refactoring icon, part 2
1. Add baidu, fix #576, #582 2. Refactoring
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Wox
|
||||
base.OnStartup(e);
|
||||
RegisterUnhandledException();
|
||||
|
||||
Task.Factory.StartNew(ImageLoader.PreloadImages);
|
||||
ImageLoader.PreloadImages();
|
||||
|
||||
MainViewModel mainVM = new MainViewModel();
|
||||
API = new PublicAPIInstance(mainVM, mainVM._settings);
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Wox.Converters
|
||||
{
|
||||
public abstract class ConvertorBase<T> : MarkupExtension, IValueConverter where T : class, new()
|
||||
{
|
||||
private static T converter;
|
||||
|
||||
/// <summary>
|
||||
/// Must be implemented in inheritor.
|
||||
/// </summary>
|
||||
public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);
|
||||
|
||||
/// <summary>
|
||||
/// Override if needed.
|
||||
/// </summary>
|
||||
public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return converter ?? (converter = new T());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
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"
|
||||
xmlns:converters="clr-namespace:Wox.Converters"
|
||||
xmlns:image="clr-namespace:Wox.Infrastructure.Image;assembly=Wox.Infrastructure"
|
||||
xmlns:vm="clr-namespace:Wox.ViewModel"
|
||||
mc:Ignorable="d" d:DesignWidth="100" d:DesignHeight="100"
|
||||
d:DataContext="{d:DesignInstance vm:ResultsViewModel}"
|
||||
@@ -27,7 +27,7 @@
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5"
|
||||
Cursor="Hand" UseLayoutRounding="False">
|
||||
<Grid.Resources>
|
||||
<converters:ImagePathConverter x:Key="ImageConverter" />
|
||||
<image:ImagePathConverter x:Key="ImageConverter" />
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="32" />
|
||||
@@ -35,7 +35,7 @@
|
||||
<ColumnDefinition Width="0" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="imgIco" Width="32" Height="32" HorizontalAlignment="Left"
|
||||
Source="{Binding FullIcoPath,Converter={StaticResource ImageConverter},IsAsync=True}" />
|
||||
Source="{Binding IcoPath,Converter={StaticResource ImageConverter},IsAsync=True}" />
|
||||
<Grid Margin="5 0 5 0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
xmlns:wox="clr-namespace:Wox"
|
||||
x:Class="Wox.SettingWindow"
|
||||
xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin"
|
||||
xmlns:converters="clr-namespace:Wox.Converters"
|
||||
xmlns:userSettings="clr-namespace:Wox.Core.UserSettings;assembly=Wox.Core"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:image="clr-namespace:Wox.Infrastructure.Image;assembly=Wox.Infrastructure"
|
||||
Icon="Images\app.png"
|
||||
Title="{DynamicResource woxsettings}"
|
||||
ResizeMode="NoResize"
|
||||
@@ -18,7 +16,7 @@
|
||||
IsHitTestVisible="False" x:Key="FeatureBoxSeperator">
|
||||
<Separator Width="{Binding ElementName=lbPlugins, Path=ActualWidth}" />
|
||||
</ListBoxItem>
|
||||
<converters:ImagePathConverter x:Key="ImageConverter" />
|
||||
<image:ImagePathConverter x:Key="ImageConverter" />
|
||||
</Window.Resources>
|
||||
<TabControl Height="auto" x:Name="settingTab" SelectionChanged="settingTab_SelectionChanged">
|
||||
<TabItem Header="{DynamicResource general}">
|
||||
@@ -70,7 +68,7 @@
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Width="32" Height="32" HorizontalAlignment="Left"
|
||||
Source="{Binding Metadata.FullIcoPath,Converter={StaticResource ImageConverter},IsAsync=True}" />
|
||||
Source="{Binding Metadata.IcoPath,Converter={StaticResource ImageConverter},IsAsync=True}" />
|
||||
<Grid Margin="3 0 3 0" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace Wox
|
||||
pluginAuthor.Text = InternationalizationManager.Instance.GetTranslation("author") + ": " + pair.Metadata.Author;
|
||||
pluginSubTitle.Text = pair.Metadata.Description;
|
||||
pluginId = pair.Metadata.ID;
|
||||
pluginIcon.Source = ImageLoader.Load(pair.Metadata.FullIcoPath);
|
||||
pluginIcon.Source = ImageLoader.Load(pair.Metadata.IcoPath);
|
||||
|
||||
var customizedPluginConfig = _settings.PluginSettings[pluginId];
|
||||
cbDisablePlugin.IsChecked = customizedPluginConfig != null && customizedPluginConfig.Disabled;
|
||||
|
||||
@@ -35,9 +35,10 @@ namespace Wox.ViewModel
|
||||
|
||||
public string SubTitle => RawResult.SubTitle;
|
||||
|
||||
public string FullIcoPath => RawResult.FullIcoPath;
|
||||
|
||||
public string PluginID => RawResult.PluginID;
|
||||
|
||||
public string IcoPath => RawResult.IcoPath;
|
||||
|
||||
public int Score
|
||||
{
|
||||
get { return RawResult.Score; }
|
||||
|
||||
@@ -122,8 +122,6 @@
|
||||
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="CommandArgs\ToggleCommandArg.cs" />
|
||||
<Compile Include="Converters\ConvertorBase.cs" />
|
||||
<Compile Include="Converters\ImagePathConverter.cs" />
|
||||
<Compile Include="Helper\VisibilityExtensions.cs" />
|
||||
<Compile Include="Helper\SingletonWindowOpener.cs" />
|
||||
<Compile Include="NotifyIconManager.cs" />
|
||||
@@ -378,9 +376,7 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Extensions\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /Y $(ProjectDir)Themes\* $(TargetDir)Themes\
|
||||
|
||||
Reference in New Issue
Block a user