Exemplo n.º 1
0
        private ModelStateDictionary GetError(AbstractResult result)
        {
            ModelStateDictionary model = new ModelStateDictionary {
            };

            if (result.Errors == null || result.Errors.Count() == 0)
            {
                return(model);
            }

            foreach (var error in result.Errors)
            {
                model.AddModelError(error.MembershipName, error.DetailError);
            }

            return(model);
        }
Exemplo n.º 2
0
        protected void OnPacketReceived(Packet p, int packetSize)
        {
            if (p.Command != null)
            {
#if __WINDOWS__
                if (typeof(AbstractResult).GetTypeInfo().IsAssignableFrom(p.Command.GetType().GetTypeInfo()))
                {
#else
                if (typeof(AbstractResult).IsAssignableFrom(p.Command.GetType()))
                {
#endif
                    AbstractResult result = ((AbstractResult)p.Command);
                    result.Configure(p, session);
                    if (result.ExecuteAsync())
                    {
                        session.SubmitAction(p.Command);
                    }
                    else
                    {
                        p.Command.Execute();
                    }
                }
                else
                {
                    session.SubmitAction(p.Command);
                }
            }
            else
            {
                //If it has a payload, we've already got the IRTCommand from the user
                if (!p.hasPayload)
                {
                    IRTCommand cmd = CustomCommand.pool.Pop().Configure(p.OpCode, p.Sender.GetValueOrDefault(0), null, p.Data, 0, session, packetSize);
                    if (cmd != null)
                    {
                        session.SubmitAction(cmd);
                    }
                }
            }
        }
    }
        public ResultView(ApplicationView view, AbstractResult _result)
        {
            _MainView = view;

            Result = _result;

            Difficulty = (Difficulty)view.CurrentDifficulty;

            ErrorsVisibility = Visibility.Visible;

            if (Result is TestResult)
            {
                ErrorsVisibility = Visibility.Collapsed;
            }
            else if (Result is DiagramResult)
            {
                var result = (DiagramResult)Result;

                Errors = new ObservableCollection <string>(result.ErrorMessages);
            }
        }
 public ResultDecorator(AbstractResult toDecorate)
 {
     decorated = toDecorate;
 }