public void Map(Enum eventType, ICoreCommand command) { if (RegisterCommand(eventType, command)) { _eventDispatcher.Add(eventType, OnEventReceived); } }
private void ResolveDependencies(ICoreCommand command) { if (_injector != null) { _injector.Inject(command, InjectionMode.ResolveOnly); } }
/// <summary> /// Aborts latest command if it's possible /// </summary> /// <param name="c"></param> protected void abortCommand(ICoreCommand c) { if (receivedCommands.Count < 1) { return; } ICoreCommand last = receivedCommands.Peek(); if (last.Type == CoreCommandType.BuildCancel) { abort = false; } }
private bool RegisterCommand(Enum eventType, ICoreCommand command) { bool newKey = false; if (!_commandMap.ContainsKey(eventType)) { newKey = true; _commandMap.Add(eventType, new List <ICoreCommand>()); } _commandMap[eventType].Add(command); ResolveDependencies(command); return(newKey); }
protected void rawCommand(ICoreCommand c) { if (c.Args.Length < 1) { msg("RawCommand is incorrect or broken."); return; } switch (c.Args[0].ToString()) { case "property.set": { setProperty(c.Args[1].ToString(), c.Args[2].ToString()); return; } case "property.del": { setProperty(c.Args[1].ToString(), null); return; } } }
/// <summary> /// Aborts latest command if it's possible /// </summary> /// <param name="c"></param> protected void abortCommand(ICoreCommand c) { if(receivedCommands.Count < 1) { return; } ICoreCommand last = receivedCommands.Peek(); if(last.Type == CoreCommandType.BuildCancel) { abort = false; } }