2013-12-22 19:35:21 +08:00
|
|
|
|
using System;
|
2014-01-03 23:52:36 +08:00
|
|
|
|
using System.IO;
|
2013-12-22 19:35:21 +08:00
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using WinAlfred.Plugin;
|
|
|
|
|
|
|
|
|
|
namespace WinAlfred
|
|
|
|
|
{
|
|
|
|
|
public partial class ResultItem : UserControl
|
|
|
|
|
{
|
|
|
|
|
private bool selected;
|
|
|
|
|
|
|
|
|
|
public Result Result { get; private set; }
|
|
|
|
|
|
|
|
|
|
public bool Selected
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
selected = value;
|
2013-12-23 00:10:46 +08:00
|
|
|
|
BrushConverter bc = new BrushConverter();
|
|
|
|
|
Background = selected ? (Brush)(bc.ConvertFrom("#d1d1d1")) : (Brush)(bc.ConvertFrom("#ebebeb"));
|
2013-12-22 19:35:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-23 00:10:46 +08:00
|
|
|
|
public void SetIndex(int index)
|
|
|
|
|
{
|
|
|
|
|
tbIndex.Text = index.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-22 19:35:21 +08:00
|
|
|
|
public ResultItem(Result result)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
Result = result;
|
|
|
|
|
|
|
|
|
|
tbTitle.Text = result.Title;
|
|
|
|
|
tbSubTitle.Text = result.SubTitle;
|
2014-01-03 23:52:36 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(result.IcoPath) && File.Exists(result.PluginDirectory + result.IcoPath))
|
2013-12-22 19:35:21 +08:00
|
|
|
|
{
|
|
|
|
|
imgIco.Source = new BitmapImage(new Uri(result.PluginDirectory + result.IcoPath));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|