mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Databinding for plugin tab + faster image load
This commit is contained in:
34
Wox/ViewModel/PluginViewModel.cs
Normal file
34
Wox/ViewModel/PluginViewModel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Wox.Plugin;
|
||||
using PropertyChanged;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Infrastructure.Image;
|
||||
|
||||
namespace Wox.ViewModel
|
||||
{
|
||||
[ImplementPropertyChanged]
|
||||
public class PluginViewModel
|
||||
{
|
||||
public PluginPair PluginPair { get; set; }
|
||||
public PluginMetadata Metadata { get; set; }
|
||||
public IPlugin Plugin { get; set; }
|
||||
|
||||
private readonly Internationalization _translator = InternationalizationManager.Instance;
|
||||
|
||||
public ImageSource Image => ImageLoader.Load(Metadata.IcoPath);
|
||||
public Visibility ActionKeywordsVisibility => Metadata.ActionKeywords.Count > 1 ? Visibility.Collapsed : Visibility.Visible;
|
||||
public string InitilizaTime => string.Format(_translator.GetTranslation("plugin_init_time"), Metadata.InitTime);
|
||||
public string QueryTime => string.Format(_translator.GetTranslation("plugin_query_time"), Metadata.AvgQueryTime);
|
||||
public string ActionKeywordsText
|
||||
{
|
||||
get
|
||||
{
|
||||
var text = string.Join(Query.ActionKeywordSeperater, Metadata.ActionKeywords);
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user