2016-06-23 07:22:41 +08:00
|
|
|
|
using System.Windows.Media;
|
2016-05-22 12:30:38 +08:00
|
|
|
|
using Wox.Infrastructure.Image;
|
2016-02-18 19:31:15 +08:00
|
|
|
|
using Wox.Plugin;
|
2016-05-22 12:30:38 +08:00
|
|
|
|
|
2016-02-18 19:31:15 +08:00
|
|
|
|
|
|
|
|
|
namespace Wox.ViewModel
|
|
|
|
|
{
|
2016-05-24 05:08:13 +08:00
|
|
|
|
public class ResultViewModel : BaseModel
|
2016-02-18 19:31:15 +08:00
|
|
|
|
{
|
2016-02-21 23:19:42 +08:00
|
|
|
|
public ResultViewModel(Result result)
|
2016-02-18 19:31:15 +08:00
|
|
|
|
{
|
2016-02-23 05:47:10 +08:00
|
|
|
|
if (result != null)
|
2016-02-18 19:31:15 +08:00
|
|
|
|
{
|
2016-06-23 07:22:41 +08:00
|
|
|
|
Result = result;
|
2016-02-18 19:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-23 07:22:41 +08:00
|
|
|
|
public ImageSource Image => ImageLoader.Load(Result.IcoPath);
|
2016-02-19 23:26:13 +08:00
|
|
|
|
|
2016-06-23 07:22:41 +08:00
|
|
|
|
public Result Result { get; }
|
2016-04-21 08:53:21 +08:00
|
|
|
|
|
2016-02-18 22:53:41 +08:00
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
2016-06-23 07:26:57 +08:00
|
|
|
|
var r = obj as ResultViewModel;
|
2016-02-18 22:53:41 +08:00
|
|
|
|
if (r != null)
|
|
|
|
|
{
|
2016-06-23 07:22:41 +08:00
|
|
|
|
return Result.Equals(r.Result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
2016-02-18 22:53:41 +08:00
|
|
|
|
}
|
2016-02-19 22:55:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
2016-06-23 07:22:41 +08:00
|
|
|
|
return Result.GetHashCode();
|
2016-02-19 22:55:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2016-06-23 07:22:41 +08:00
|
|
|
|
return Result.ToString();
|
2016-02-18 22:53:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-18 19:31:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|