2013-12-19 23:51:20 +08:00
|
|
|
|
using System;
|
2013-12-20 19:38:10 +08:00
|
|
|
|
using System.Collections.Generic;
|
2014-07-16 18:52:00 +08:00
|
|
|
|
using System.IO;
|
2013-12-19 23:51:20 +08:00
|
|
|
|
|
2014-10-23 18:39:11 +08:00
|
|
|
|
namespace Wox.Plugin
|
|
|
|
|
{
|
2014-07-05 23:10:34 +08:00
|
|
|
|
|
2014-10-23 18:39:11 +08:00
|
|
|
|
public class Result
|
|
|
|
|
{
|
|
|
|
|
public string Title { get; set; }
|
|
|
|
|
public string SubTitle { get; set; }
|
|
|
|
|
public string IcoPath { get; set; }
|
|
|
|
|
|
|
|
|
|
public string FullIcoPath
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2014-07-17 18:51:34 +08:00
|
|
|
|
if (string.IsNullOrEmpty(IcoPath)) return string.Empty;
|
2014-10-23 18:39:11 +08:00
|
|
|
|
if (IcoPath.StartsWith("data:"))
|
|
|
|
|
{
|
|
|
|
|
return IcoPath;
|
|
|
|
|
}
|
2014-07-16 18:52:00 +08:00
|
|
|
|
|
|
|
|
|
return Path.Combine(PluginDirectory, IcoPath);
|
2014-10-23 18:39:11 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// return true to hide wox after select result
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Func<ActionContext, bool> Action { get; set; }
|
|
|
|
|
|
|
|
|
|
public int Score { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Only resulsts that originQuery match with curren query will be displayed in the panel
|
|
|
|
|
/// </summary>
|
2015-01-24 22:34:55 +08:00
|
|
|
|
internal Query OriginQuery { get; set; }
|
2014-10-23 18:39:11 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2015-01-24 22:34:55 +08:00
|
|
|
|
/// Plugin directory
|
2014-10-23 18:39:11 +08:00
|
|
|
|
/// </summary>
|
2015-01-24 22:34:55 +08:00
|
|
|
|
public string PluginDirectory { get; internal set; }
|
2014-10-23 18:39:11 +08:00
|
|
|
|
|
|
|
|
|
public new bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
if (obj == null || !(obj is Result)) return false;
|
|
|
|
|
|
|
|
|
|
Result r = (Result)obj;
|
|
|
|
|
return r.Title == Title && r.SubTitle == SubTitle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return Title + SubTitle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Result()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Result(string Title = null, string IcoPath = null, string SubTitle = null)
|
|
|
|
|
{
|
|
|
|
|
this.Title = Title;
|
|
|
|
|
this.IcoPath = IcoPath;
|
|
|
|
|
this.SubTitle = SubTitle;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-07 23:49:46 +08:00
|
|
|
|
[Obsolete("Use IContextMenu instead")]
|
2015-01-24 22:34:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Context menus associate with this result
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<Result> ContextMenu { get; set; }
|
|
|
|
|
|
2015-02-04 23:16:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Additional data associate with this result
|
|
|
|
|
/// </summary>
|
|
|
|
|
public object ContextData { get; set; }
|
|
|
|
|
|
2015-01-24 22:34:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Plugin ID that generate this result
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string PluginID { get; set; }
|
2014-10-23 18:39:11 +08:00
|
|
|
|
}
|
2013-12-19 23:51:20 +08:00
|
|
|
|
}
|