protected override void OnInquiryActionComplete(InquiryActionResult <TEntity> result) { switch (result.Result) { case InquiryActionResultType.RequestedNew: this.OnAddNew(); break; default: base.OnInquiryActionComplete(result); break; } }
protected override void OnInquiryActionComplete(InquiryActionResult <UserLogin> result) { if (result.Result == InquiryActionResultType.DataFetched) { Channel <AuthenticationInfo> .Public.OnNext( new AuthenticationInfo { Action = AuthenticationAction.LoggedIn, UserId = this.UserId }, true); ServiceLocator.GetService <IVirtualDesktopManager>().CloseDialog(); } else if (result.Result == InquiryActionResultType.DataNotFound) { this.NotificationMessage = "Username and password do not match."; this.ViewMode = ViewModeType.Default; } }
protected virtual void OnInquiryActionComplete(InquiryActionResult <TEntity> result) { switch (result.Result) { case InquiryActionResultType.DataNotFound: this.OriginalEntity = null; this.ResetDataModel(); this.ViewMode = ViewModeType.ViewOnly; break; case InquiryActionResultType.RequestedNew: throw new InvalidOperationException("Requested New is not valid on this type of ViewModel"); case InquiryActionResultType.DataFetched: this.ResetDataModel(result.Data); this.OriginalEntity = this.entity; this.ViewMode = ViewModeType.ViewOnly; break; } }
protected override void OnInquiryAction(InquiryActionResult <UserLogin> result) { result.Data = this.Entity; result.Result = InquiryActionResultType.DataFetched; }
protected override void OnInquiryAction(InquiryActionResult <EmpresaEntity> result) { }
protected abstract void OnInquiryAction(InquiryActionResult <TEntity> result);
protected void OnInquiryData() { InquiryActionResult <TEntity> result = new InquiryActionResult <TEntity> { Result = InquiryActionResultType.DataNotFound }; this.ViewMode = ViewModeType.Busy; this.StatusMessage = "Obteniendo datos, espere por favor ..."; Task task = Task.Factory.StartNew ( (o) => { Logger.Debug("Obteniendo datos '{0}'", this.Entity.ToString()); this.OnInquiryAction(result); }, result ); task.ContinueWith ( (t) => { Logger.Debug("Error al obtener datos '{0}'", t.Exception.InnerException.ToString()); this.OnInquiryActionFailed(); Exception exception = null; this.OriginalEntity = null; if (t.Exception.InnerException != null) { exception = t.Exception.InnerException; } else { exception = t.Exception; } this.NotificationMessage = exception.Message; }, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent, TaskScheduler.FromCurrentSynchronizationContext() ); task.ContinueWith ( _ => { Logger.Debug("Datos obtenidos correctamente '{0}'", this.Entity.ToString()); this.StatusMessage = null; this.OnInquiryActionComplete(result); }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent, TaskScheduler.FromCurrentSynchronizationContext() ); }