PowerToys/Wox/Commands/CommandFactory.cs

39 lines
898 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
2014-01-29 18:33:24 +08:00
using Wox.Helper;
using Wox.Plugin;
using Wox.PluginLoader;
2014-01-29 18:33:24 +08:00
namespace Wox.Commands
{
internal static class CommandFactory
{
private static PluginCommand pluginCmd;
private static SystemCommand systemCmd;
2014-03-18 23:41:34 +08:00
public static void DispatchCommand(Query query)
{
//lazy init command instance.
if (pluginCmd == null)
{
pluginCmd = new PluginCommand();
}
if (systemCmd == null)
{
systemCmd = new SystemCommand();
}
if (Plugins.HitThirdpartyKeyword(query))
{
pluginCmd.Dispatch(query);
}
else
{
systemCmd.Dispatch(query);
}
}
}
}