PowerToys/Wox/ViewModel/ResultViewModel.cs

47 lines
934 B
C#
Raw Normal View History

2016-06-23 07:22:41 +08:00
using System.Windows.Media;
using Wox.Infrastructure.Image;
using Wox.Plugin;
namespace Wox.ViewModel
{
public class ResultViewModel : BaseModel
{
public ResultViewModel(Result result)
{
if (result != null)
{
2016-06-23 07:22:41 +08:00
Result = result;
}
}
2016-06-23 07:22:41 +08:00
public ImageSource Image => ImageLoader.Load(Result.IcoPath);
2016-06-23 07:22:41 +08:00
public Result Result { get; }
2016-02-18 22:53:41 +08:00
public override bool Equals(object obj)
{
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
}
}
public override int GetHashCode()
{
2016-06-23 07:22:41 +08:00
return Result.GetHashCode();
}
public override string ToString()
{
2016-06-23 07:22:41 +08:00
return Result.ToString();
2016-02-18 22:53:41 +08:00
}
}
}