public void BeforeEachTest() { _actionRegistry = new ActionRegistry(); _actionRegistry.RegisterAction <OpenAction>(); _actionRegistry.RegisterAction <ContainingFolderConverter>(); _actionRegistry.RegisterAction <GoogleAction>(); }
public virtual void Dispatch(string dispatchee, string parameters) { if (ActionRegistry.TryGetValue(dispatchee, out var actionImpl)) { var extracted = parameters.ToParameters(); actionImpl(extracted); } }
public void InitializeActionRegistry() { ActionRegistry = new ActionRegistry(); ActionRegistry.Reg("create", new CreateActionHandler(Client)); ActionRegistry.Reg("retreive", new ReadActionHandler(Client)); ActionRegistry.Reg("list", new ReadActionHandler(Client)); ActionRegistry.Reg("update", new UpdateActionHandler(Client)); ActionRegistry.Reg("delete", new DeleteActionHandler(Client)); }
public Session() { Context = new DatabaseContext(); PluginManager = new PluginManager(Context); ActionRegistry = ActionRegistry.Create(); ActionHandler = new ActionHandler(); TransfersHandler = new TransfersHandler(this); Initialize(); }
public MainViewModel() { _actionRegistry = new ActionRegistry(); _actionRegistry.RegisterIndexer(() => new ControlPanelIndexer().GetControlPanelItems()); _actionRegistry.RegisterIndexer(() => new WindowsStoreAppIndexer().GetWindowsStoreApps()); _actionRegistry.RegisterAction <OpenAction>(); _actionRegistry.RegisterAction <OpenAsAdminAction>(); _actionRegistry.RegisterAction <ContainingFolderConverter>(); _actionRegistry.RegisterAction <WindowsStoreAppOpenAction>(); var frecencyPath = CatapultPaths.FrecencyPath; _frecencyStorage = new FrecencyStorage(frecencyPath); _actionRegistry.RegisterAction <KillProcessAction>(); _actionRegistry.RegisterAction <OpenLastLogAction>(); _actionRegistry.RegisterAction <OpenLogFolderAction>(); _actionRegistry.RegisterAction <OpenConfigAction>(); _actionRegistry.RegisterAction <EnableRunAtStartUpAction>(); _actionRegistry.RegisterAction <DisableRunAtStartUpAction>(); _actionRegistry.RegisterAction <ReindexFilesAction>(); _actionRegistry.RegisterAction <CheckForUpdatesAction>(); CheckForUpdatesAction.UpdateCheckAction = SquirrelIntegration.Instance.CheckForUpdates; SquirrelIntegration.OnUpdateFound += version => { _actionRegistry.RegisterAction <UpgradeCatapultAction>(); UpgradeCatapultAction.UpgradeAction = SquirrelIntegration.Instance.UpgradeToNewVersion; }; _actionRegistry.RegisterAction <GoogleAction>(); _actionRegistry.RegisterAction <WikipediaAction>(); _actionRegistry.RegisterAction <ClipboardHistoryAction>(); _actionRegistry.RegisterAction <UnderscorizeClipboardString>(); _actionRegistry.RegisterAction <TripleBacktickClipboardString>(); _actionRegistry.RegisterAction <WindowsSleepAction>(); _actionRegistry.RegisterAction <WindowsRestartAction>(); _actionRegistry.RegisterAction <WindowsShutdownAction>(); _actionRegistry.RegisterAction <WindowsShutdownForceAction>(); _actionRegistry.RegisterAction <WindowsLockComputerAction>(); _actionRegistry.RegisterAction <WindowsLogOffAction>(); FileIconResolver.ResolverFunc = WindowsFileIconResolver.Resolve; Reset(); StartIntentService(Dispatcher.CurrentDispatcher); StackPushed += MainViewModel_StackPushed; }
/// <summary> /// Set up the fields for this program. /// </summary> public static new void Initialize() { Registry = new ActionRegistry(); BasicProgram.Initialize(); }
/// <summary> /// Creates a new loop that will run the specified actions. /// </summary> /// <param name="registry">The actions to perform.</param> /// <param name="debug">Whether or not to run in debug mode.</param> public HourlyTimer(ActionRegistry registry, bool debug = false) : base(registry, debug) { }
public void Execute() { var command = ""; while (command != "q") { Console.WriteLine(); Console.WriteLine("Enter command (q => exit, h => help)"); Console.Write("> "); command = Console.ReadLine(); // retreive:users if (command == "h") { PrintActions(); continue; } else if (command == "q") { break; } if (!Client.CommandExists(command)) { continue; } var actionHandler = ActionRegistry.Get(command); if (actionHandler == null) { Console.WriteLine("Unsupported"); continue; } var template = ReadTemplate(command); var link = Client.GetLink(command); var resolvedLink = Helpers.UriParser.ParseLinkObject(link, template); var linkUri = Client.GetUri(resolvedLink); Request request; if (actionHandler.HasBody) { var objectReader = ObjectReaderRegistry.Get(command); if (objectReader == null) { Console.WriteLine("Unsupported"); continue; } request = new Request(linkUri, objectReader.ReadFromConsole(true)); } else { request = new Request(linkUri); } try { var response = actionHandler.Execute(request); PrintResponse(response); } catch { // Ignored } } }
/// <summary> /// Create a new timer with a registry of actions. /// </summary> /// <param name="registry">A list of actions to perform at specific intervals.</param> /// <param name="debug">Whether or not to run in debug mode.</param> public DelayTimerNew(ActionRegistry registry, bool debug = false) : base(registry, debug) { }
/// <summary> /// Create a new instace of this class. /// </summary> /// <param name="registry">The registry of actions this timer will perform.</param> /// <param name="debug">Whether or not to run in debug mode.</param> public Timeable(ActionRegistry registry, bool debug) { ActionRegistry = registry; Debug = debug; }