Implement ToString and GetHashCode methods for ResultItemViewModel

This commit is contained in:
Colin Liu 2016-02-19 22:55:58 +08:00
parent 68ee35d03b
commit 2efcbd060a
2 changed files with 17 additions and 9 deletions

View File

@ -119,14 +119,20 @@ namespace Wox.ViewModel
ResultItemViewModel r = obj as ResultItemViewModel;
if (r != null)
{
var equality = string.Equals(r.Title, Title) &&
string.Equals(r.SubTitle, SubTitle);
return equality;
}
else
{
return false;
return _result.Equals(r.RawResult);
}
return false;
}
public override int GetHashCode()
{
return _result.GetHashCode();
}
public override string ToString()
{
return _result.ToString();
}
public event EventHandler<ResultOpenedEventArgs> ResultOpened;

View File

@ -79,7 +79,7 @@ namespace Wox.ViewModel
}
set
{
if (value != _selectedResult)
if (null != value)
{
if (null != _selectedResult)
{
@ -93,8 +93,10 @@ namespace Wox.ViewModel
_selectedResult.IsSelected = true;
}
OnPropertyChanged("SelectedResult");
}
OnPropertyChanged("SelectedResult");
}
}