mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-08 04:17:55 +08:00
397b1533f0
* Basic WPF searchbox working * Updated key navigation and removed coldstart for searhbox * refactored and added code back in commented * Removed XAML Island references * Basic searchbox+listview working * Getting a bit more back * got color there * Result list bit better now * Added image loader for WPF Image * Partially got the context menus rendering again * adjusting coldstart to load, control will load with main form * getting context menus back * mouse over works now * Click now works, started to remove Win.XAML references * being a bit more forcusful on focus * Shadow text is not aligned * fixing focus if listbox was used * small tweak to fix shadow text * inputs don't work but gotta figure out why. commenting out * preview text * adding back in delay * fixed height issue * Applied the correct context button styles * Created custom ItemContainerStyle to fix the blue highlights behind the command buttons * Applied the correct highlight / mouseover styling * Removed vertical scrollbar in listview * fixed for alt-space prompt * Fixed right click focus issue * Somil55/wpf modifier keys (#3378) * Removed DPI change as it was not required * Global key hooks for context menu items * Updated Key for shell, folder and indexer plugin * Updated key mapping for indexer plugin * Somil55/wpf context menu selection (#3389) * Removed DPI change as it was not required * Global key hooks for context menu items * Updated Key for shell, folder and indexer plugin * Updated key mapping for indexer plugin * Add trigger to selection on tabbing * Minor shadow adjustments so its more similiar to default shell shadow. Added intro/outro animations * Added UWP-like scrollbar style for the results list * Fixed formating and naming * Removed Powerlauncher UI project * Update PowerToys.sln * Commented out scrollbar and fade in/out animations * Added missing features from UWP branch * Fixed formatting for Product.wxs * Add dragging to WPF window Co-authored-by: Clint Rutkas <clint@rutkas.com> Co-authored-by: Niels Laute <niels.laute@live.nl>
136 lines
3.8 KiB
C#
136 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Windows.Media;
|
|
|
|
namespace Wox.Plugin
|
|
{
|
|
|
|
public class Result
|
|
{
|
|
|
|
private string _pluginDirectory;
|
|
private string _icoPath;
|
|
public string Title { get; set; }
|
|
public string SubTitle { get; set; }
|
|
|
|
public string Glyph { get; set; }
|
|
|
|
public string FontFamily { get; set; }
|
|
|
|
/// <summary>
|
|
/// The text that will get displayed in the Search text box, when this item is selected in the result list.
|
|
/// </summary>
|
|
public string QueryTextDisplay { get; set; }
|
|
|
|
public string IcoPath
|
|
{
|
|
get { return _icoPath; }
|
|
set
|
|
{
|
|
if (!string.IsNullOrEmpty(PluginDirectory) && !Path.IsPathRooted(value))
|
|
{
|
|
_icoPath = Path.Combine(value, IcoPath);
|
|
}
|
|
else
|
|
{
|
|
_icoPath = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public delegate ImageSource IconDelegate();
|
|
|
|
public IconDelegate Icon;
|
|
|
|
|
|
/// <summary>
|
|
/// return true to hide wox after select result
|
|
/// </summary>
|
|
public Func<ActionContext, bool> Action { get; set; }
|
|
|
|
public int Score { get; set; }
|
|
|
|
/// <summary>
|
|
/// A list of indexes for the characters to be highlighted in Title
|
|
/// </summary>
|
|
public IList<int> TitleHighlightData { get; set; }
|
|
|
|
/// <summary>
|
|
/// A list of indexes for the characters to be highlighted in SubTitle
|
|
/// </summary>
|
|
public IList<int> SubTitleHighlightData { get; set; }
|
|
|
|
/// <summary>
|
|
/// Only results that originQuery match with current query will be displayed in the panel
|
|
/// </summary>
|
|
internal Query OriginQuery { get; set; }
|
|
|
|
/// <summary>
|
|
/// Plugin directory
|
|
/// </summary>
|
|
public string PluginDirectory
|
|
{
|
|
get { return _pluginDirectory; }
|
|
set
|
|
{
|
|
_pluginDirectory = value;
|
|
if (!string.IsNullOrEmpty(IcoPath) && !Path.IsPathRooted(IcoPath))
|
|
{
|
|
IcoPath = Path.Combine(value, IcoPath);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
var r = obj as Result;
|
|
|
|
var equality = string.Equals(r?.Title, Title) &&
|
|
string.Equals(r?.SubTitle, SubTitle) &&
|
|
string.Equals(r?.IcoPath, IcoPath) &&
|
|
TitleHighlightData == r.TitleHighlightData &&
|
|
SubTitleHighlightData == r.SubTitleHighlightData;
|
|
|
|
return equality;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
var hashcode = (Title?.GetHashCode() ?? 0) ^
|
|
(SubTitle?.GetHashCode() ?? 0);
|
|
return hashcode;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Title + SubTitle;
|
|
}
|
|
|
|
[Obsolete("Use IContextMenu instead")]
|
|
/// <summary>
|
|
/// Context menus associate with this result
|
|
/// </summary>
|
|
public List<Result> ContextMenu { get; set; }
|
|
|
|
[Obsolete("Use Object initializers instead")]
|
|
public Result(string Title, string IcoPath, string SubTitle = null)
|
|
{
|
|
this.Title = Title;
|
|
this.IcoPath = IcoPath;
|
|
this.SubTitle = SubTitle;
|
|
}
|
|
|
|
public Result() { }
|
|
|
|
/// <summary>
|
|
/// Additional data associate with this result
|
|
/// </summary>
|
|
public object ContextData { get; set; }
|
|
|
|
/// <summary>
|
|
/// Plugin ID that generated this result
|
|
/// </summary>
|
|
public string PluginID { get; internal set; }
|
|
}
|
|
} |