2013-12-19 23:51:20 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Windows.Forms;
|
2013-12-20 19:38:10 +08:00
|
|
|
|
using WinAlfred.Plugin;
|
|
|
|
|
|
using WinAlfred.PluginLoader;
|
2013-12-19 23:51:20 +08:00
|
|
|
|
|
|
|
|
|
|
namespace WinAlfred
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class FrmMain : Form
|
|
|
|
|
|
{
|
2013-12-20 19:38:10 +08:00
|
|
|
|
public List<IPlugin> plugins = new List<IPlugin>();
|
|
|
|
|
|
private List<Result> results = new List<Result>();
|
|
|
|
|
|
|
2013-12-19 23:51:20 +08:00
|
|
|
|
public FrmMain()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
2013-12-20 19:38:10 +08:00
|
|
|
|
|
|
|
|
|
|
private void FrmMain_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
plugins.AddRange(new PythonPluginLoader().LoadPlugin());
|
|
|
|
|
|
plugins.AddRange(new CSharpPluginLoader().LoadPlugin());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void TbQuery_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
results.Clear();
|
|
|
|
|
|
foreach (IPlugin plugin in plugins)
|
|
|
|
|
|
{
|
|
|
|
|
|
results.AddRange(plugin.Query(new Query(tbQuery.Text)));
|
|
|
|
|
|
}
|
|
|
|
|
|
var s = results.OrderByDescending(o => o.Score);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-12-19 23:51:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|