Esempio n. 1
0
 public void Map(Enum eventType, ICoreCommand command)
 {
     if (RegisterCommand(eventType, command))
     {
         _eventDispatcher.Add(eventType, OnEventReceived);
     }
 }
Esempio n. 2
0
 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;
            }
        }
Esempio n. 4
0
        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;
            }
        }