mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 11:39:16 +08:00
b589a1a13e
1. Move ResultListBox Visibility from MainViewModel to ResultsViewModel 2. Refactoring
47 lines
934 B
C#
47 lines
934 B
C#
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)
|
|
{
|
|
Result = result;
|
|
}
|
|
}
|
|
|
|
public ImageSource Image => ImageLoader.Load(Result.IcoPath);
|
|
|
|
public Result Result { get; }
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
var r = obj as ResultViewModel;
|
|
if (r != null)
|
|
{
|
|
return Result.Equals(r.Result);
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return Result.GetHashCode();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Result.ToString();
|
|
}
|
|
|
|
}
|
|
}
|