示例#1
0
 void realizeAsyncError(object sender, CommandReceivedEventArgs <T, AsyncError <T> > e)
 {
     // TODO: check behaviour!
     if (Realize <AsyncError <T> >(sender, e))
     {
         string message = string.Format("Device says: {0}", e.Command.Message);
         OnSystemDown(true);
         OnAsyncReplyReceived(message);
         // TODO: subscribe in Config for event
         Config.logCrash(message);
     }
 }
示例#2
0
        protected bool Realize <T1>(object sender, CommandReceivedEventArgs <T, T1> e)
            where T1 : ServicePacket <T>
        {
            //byte code = e.Code;
            var command = e.Command;

            if (!dictionary.ContainsKey(command))
            {
                // Strange error
                return(false);
            }
            var actor = dictionary[command];

            if (actor == null || actor.Act == null)
            {
                return(false);
            }
            actor.Act(command);
            return(true);
        }