コード例 #1
0
        private static TResult ConvertType <TResult>(MahuaCommandResult crossDomainCommandResult)
        {
            var json = GlobalCache.JavaScriptSerializer.Serialize(crossDomainCommandResult);
            var re   = GlobalCache.JavaScriptSerializer.Deserialize <TResult>(json);

            return(re);
        }
コード例 #2
0
        public void SendCommandWithResult(MahuaCommand command, out MahuaCommandResult mahuaCommandResult)
        {
            WriteDiagnostics(() => command);

            using (var beginLifetimeScope = _container.BeginLifetimeScope())
            {
                SetContainer(beginLifetimeScope);
                var center = beginLifetimeScope.Resolve <ICommandCenter>();
                center.Handle(command, out mahuaCommandResult);
                var re = mahuaCommandResult;
                WriteDiagnostics(() => re);
            }
        }
コード例 #3
0
        void ICommandCenter.Handle(MahuaCommand command, out MahuaCommandResult mahuaCommandResult)
        {
            var commandHandlers = _resultCommandHandlers.FirstOrDefault(x => x.CanHandle(command));

            mahuaCommandResult = (MahuaCommandResult)commandHandlers?.Handle(command);
        }