public TResult ExecuteSimple <TResult>(Func <TService, TResult> command) { try { // Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; if (ClientContext != null) { ClientContextBucket.SetBucket(ClientContext); } var dispatcher = ClientServiceLocator.Instance().CommandDispatcher; var result = DispatchSimpleCommand(() => dispatcher.ExecuteSimpleCommand(command)); //if (result.Response.HasWarning) //{ // ClientServiceLocator.Instance() // .WarningManager // .HandleBusinessWarning(result.Response.BusinessWarnings); //} return(result); } finally { // Mouse.OverrideCursor = null; } }
//public TResult ExecuteBatch<TResult>(Func<TService, TResult> command) // where TResult : IList<IDtoResponseEnvelop> //{ // try // { // // Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; // var dispatcher = ClientServiceLocator.Instance().CommandDispatcher; // var result = DispatchBatchCommand(() => dispatcher.ExecuteBatchCommand(command)); // //if (result.Response.HasWarning) // //{ // // ClientServiceLocator.Instance() // // .WarningManager // // .HandleBusinessWarning(result.Response.BusinessWarnings); // //} // if (result != null && result.Count > 0) // { // // Mouse.OverrideCursor = null; // var businessExceptionList = result.Select(it => it.Response.BusinessException).ToList(); // ClientServiceLocator.Instance() // .ExceptionManager // .HandleBusinessException(businessExceptionList); // } // return result; // } // finally // { // // Mouse.OverrideCursor = null; // } //} public void Execute(Action <TService> command) { try { // Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; if (ClientContext != null) { ClientContextBucket.SetBucket(ClientContext); } var dispatcher = ClientServiceLocator.Instance().CommandDispatcher; 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); //} } finally { // Mouse.OverrideCursor = null; } }
public TResult Execute <TResult>(Func <TService, TResult> command) where TResult : IDtoResponseEnvelop { try { // Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; if (ClientContext != null) { ClientContextBucket.SetBucket(ClientContext); } var dispatcher = ClientServiceLocator.Instance().CommandDispatcher; var result = DispatchCommand(() => dispatcher.ExecuteCommand(command)); //if (result.Response.HasWarning) //{ // ClientServiceLocator.Instance() // .WarningManager // .HandleBusinessWarning(result.Response.BusinessWarnings); //} if (result != null && result.Response != null && result.Response.HasException) { SetError(); // Mouse.OverrideCursor = null; ClientServiceLocator.Instance() .ExceptionManager .HandleBusinessException(result.Response.BusinessException); } else { SetUnerror(); } return(result); } finally { // Mouse.OverrideCursor = null; } }