Ejemplo n.º 1
0
 public TResult Execute <TResult>(Func <TService, TResult> command)
     where TResult : IDtoResponseEnvelop
 {
     try
     {
         Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
         var dispatcher = ClientServiceLocator.Instance().CommandDispatcher;
         var result     = DispatchCommand(() => dispatcher.ExecuteCommand(command));
         if (result.Response.HasWarning)
         {
             ClientServiceLocator.Instance()
             .WarningManager
             .HandleBusinessWarning(result.Response.BusinessWarnings);
         }
         if (result.Response.HasException)
         {
             Mouse.OverrideCursor = null;
             ClientServiceLocator.Instance()
             .ExceptionManager
             .HandleBusinessException(result.Response.BusinessException);
         }
         return(result);
     }
     finally
     {
         Mouse.OverrideCursor = null;
     }
 }
 public static ClientServiceLocator Instance()
 {
     if (InternalInstance == null)
     {
         lock (LocatorLock)
         {
             // in case of a race scenario ... check again
             if (InternalInstance == null)
             {
                 InternalInstance = new ClientServiceLocator();
             }
         }
     }
     return(InternalInstance);
 }
Ejemplo n.º 3
0
        public TResponse Execute <TResponse>(Func <TService, TResponse> command)
            where TResponse : IDtoResponseEnvelop
        {
            var dispatcher = ClientServiceLocator.Instance().CommandDispatcher;
            var result     = dispatcher.ExecuteCommand(command);

            if (result.Response.HasWarning)
            {
                // TODO: Implement Business Warning processing -- See Chapter XIV
            }
            if (result.Response.HasException)
            {
                // TODO: Implement Business Exception processing -- See Chapter XIV
            }
            return(result);
        }