/// <summary> /// StartAndNotify. /// </summary> public void StartAndNotify() { _bookingSummaryCompletion = NotifyTaskCompletion.Create <IEnumerable <BookingSummaryViewObject> >( _bookingDataService.GetPagedSummaryDoAsync(1, DefaultPageSize), (sender, ev) => { if (sender is INotifyTaskCompletion <IEnumerable <BookingSummaryViewObject> > bookingSummary) { if (bookingSummary.IsFaulted) { DialogService?.ShowErrorMessage("Cannot load booking summary: " + bookingSummary.ErrorMessage); return; } var booking = bookingSummary.Result; var maxItems = _bookingDataService.NumberItems; PageCount = _bookingDataService.NumberPage; ItemCounts = maxItems.ToString(); var bookingList = new IncrementalList <BookingSummaryViewObject>(LoadMoreItems) { MaxItemCount = (int)maxItems }; bookingList.LoadItems(booking); SummaryView = bookingList; } }); }
public void Setup() { _notifyTaskCompletion = A.Fake <INotifyTaskCompletion <object> >(); _command = CommandTask; _asyncCommandWatcher = new AsyncCommandWatcher <object>(); }
public void LoadRelatedInfo() { //PrereqsLoading = NotifyTaskCompletion.Create(LoadPrereqsAsync); //await Task.Run(() => LoadPrereqsAsync()); PrereqsLoading = NotifyTaskCompletion.Create(() => LoadPrereqsAsync()); NotifyTaskCompletion.Create(() => LoadQualificationDisplayAsync()); }
public void LoadRelatedInfo() { PlacementLoading = NotifyTaskCompletion.Create(LoadPlacementAsync); //PlacementLoading = NotifyTaskCompletion.Create(LoadPlacementsAsync); QualifiedCandidatesLoading = NotifyTaskCompletion.Create(LoadQualifiedCandidatesListAsync); }
public AsyncSimpleCommand(IAsyncCommandWatcher <object> asyncCommandWatcher, Func <Task <object> > command, INotifyTaskCompletion <object> notifyTaskCompletion) : base(asyncCommandWatcher) { _command = command; _notifyTaskCompletion = notifyTaskCompletion; _asyncCommandWatcher = asyncCommandWatcher; }
public CompanyModule(IRepository repository) { _repository = repository; // LoadPublishers(); CompanyLoading = NotifyTaskCompletion.Create(() => LoadCompaniesAsync()); }
/// <summary> /// Refreshes the exercise analysis. /// </summary> public void RefreshAnalysis() { this.LevelClassification = NotifyTaskCompletion.Create(this.GetLevelClassificationAsync()); this.LevelClassificationDistribution = NotifyTaskCompletion.Create(this.GetLevelClassificationDistributionAsync()); this.LexTutorWordsInText = NotifyTaskCompletion.Create(this.GetLexTutorWordsInTextAsync()); this.LexTutorDifferentWords = NotifyTaskCompletion.Create(this.GetLexTutorDifferentWordsAsync()); this.LexTutorTypeTokenRatio = NotifyTaskCompletion.Create(this.GetLexTutorTypeTokenRatioAsync()); this.LexTutorTokensPerType = NotifyTaskCompletion.Create(this.GetLexTutorTokensPerTypeAsync()); this.LexTutorTokens = NotifyTaskCompletion.Create(this.GetLexTutorTokensAsync()); this.LexTutorTypes = NotifyTaskCompletion.Create(this.GetLexTutorTypesAsync()); this.LexTutorFamilies = NotifyTaskCompletion.Create(this.GetLexTutorFamiliesAsync()); this.LexTutorTokensPerFamily = NotifyTaskCompletion.Create(this.GetLexTutorTokensPerFamilyAsync()); this.LexTutorTypesPerFamily = NotifyTaskCompletion.Create(this.GetLexTutorTypesPerFamilyAsync()); this.WordsInTextByPartOfSpeech = NotifyTaskCompletion.Create(this.GetWordsInTextByPartOfSpeechAsync()); this.WordsInTextByLevel = NotifyTaskCompletion.Create(this.GetWordsInTextByLevelAsync()); this.LexTutorFamilyK1 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK1()); this.LexTutorFamilyK2 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK2()); this.LexTutorFamilyK3 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK3()); this.LexTutorFamilyK4 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK4()); this.LexTutorFamilyK5 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK5()); this.LexTutorFamilyK6 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK6()); this.LexTutorFamilyK7 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK7()); this.LexTutorFamilyK8 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK8()); this.LexTutorFamilyK9 = NotifyTaskCompletion.Create(this.GetLexTutorFamilyK9()); this.LexTutorFamilyOfflist = NotifyTaskCompletion.Create(this.GetLexTutorFamilyOfflist()); this.LexTutorFamilyTotal = NotifyTaskCompletion.Create(this.GetLexTutorFamilyTotal()); }
public override void StartAndNotify() { _incidentCompletion = NotifyTaskCompletion.Create <IEnumerable <UsersSummary> >( _incidentService.GetPagedSummaryDoAsync(1, DefaultPageSize), (task, ev) => { if (task is INotifyTaskCompletion <IEnumerable <UsersSummary> > summaryCollection) { if (summaryCollection.IsSuccessfullyCompleted) { var collection = summaryCollection.Result; if (SummaryView is IncrementalList <UsersSummary> summary) { var maxItems = _incidentService.NumberItems; PageCount = __incidentService.NumberPage; var summaryList = new IncrementalList <UsersSummary>(LoadMoreItems) { MaxItemCount = (int)maxItems }; summaryList.LoadItems(collection); SummaryView = summaryList; } } else { DialogService?.ShowErrorMessage(ErrorConstants.DataLoadError + " : " + reservations.ErrorMessage); } } }); }
public void StartAndNotify() { _incidentCompletion = NotifyTaskCompletion.Create <IEnumerable <BookingIncidentSummaryViewObject> >( _incidentService.GetPagedSummaryDoAsync(1, DefaultPageSize), (task, ev) => { if (task is INotifyTaskCompletion <IEnumerable <BookingIncidentSummaryViewObject> > summaryCollection) { if (summaryCollection.IsSuccessfullyCompleted) { var collection = summaryCollection.Result; if (SummaryView is IncrementalList <BookingIncidentSummaryViewObject> summary) { var maxItems = _incidentService.NumberItems; PageCount = _incidentService.NumberPage; var summaryList = new IncrementalList <BookingIncidentSummaryViewObject>(LoadMoreItems) { MaxItemCount = (int)maxItems }; summaryList.LoadItems(collection); SummaryView = summaryList; } } else { DialogService?.ShowErrorMessage("Cannot load more pages"); } } }); }
public AsyncResultCommand(IAsyncCommandWatcher <TResult> asyncCommandWatcher, Func <Task <TResult> > command, INotifyTaskCompletion <TResult> notifyTaskCompletion) : base(asyncCommandWatcher) { _command = command; _notifyTaskCompletion = notifyTaskCompletion; _asyncCommandWatcher = asyncCommandWatcher; }
public StoreSideDrawerViewModel (CheapSharkAPI api) { Title = "Stores"; API = api; Stores = NotifyTaskCompletion.Create<ObservableCollection<StoreCellViewModel>> (GetStores); }
/// <summary> /// This load the data from the lower view model. /// </summary> /// <param name="sender"></param> /// <param name="ev"></param> private void LoadedEventHandler(object sender, PropertyChangedEventArgs ev) { INotifyTaskCompletion <ObservableCollection <ClientTypeDto> > value = sender as INotifyTaskCompletion <ObservableCollection <ClientTypeDto> >; string propertyName = ev.PropertyName; if (propertyName.Equals("Status")) { if (_clientNotifyTask.IsSuccessfullyCompleted) { if (value != null) { SourceView = value.Task.Result; } } } else if (propertyName.Equals("IsSuccessfullyCompleted")) { var result = value?.Task.Result; SourceView = result; } else { if (_clientNotifyTask.IsFaulted) { MessageBox.Show(_clientNotifyTask.ErrorMessage); } } Contract.Ensures(SourceView != null, "SourceView shall be present"); }
public void StartAndNotify() { _reservationCompletion = NotifyTaskCompletion.Create <IEnumerable <ReservationRequestSummary> >( _reservationRequestDataService.GetPagedSummaryDoAsync(1, DefaultPageSize), (task, ev) => { if (task is INotifyTaskCompletion <IEnumerable <ReservationRequestSummary> > reservations) { if (reservations.IsSuccessfullyCompleted) { var collection = reservations.Result; if (SummaryView is IncrementalList <ReservationRequestSummary> summary) { var maxItems = _reservationRequestDataService.NumberItems; PageCount = _reservationRequestDataService.NumberPage; var summaryList = new IncrementalList <ReservationRequestSummary>(LoadMoreItems) { MaxItemCount = (int)maxItems }; summaryList.LoadItems(collection); SummaryView = summaryList; } } else { DialogService?.ShowErrorMessage("No puedo cargar datos de peticiones : " + reservations.ErrorMessage); } } }); }
/// <summary> /// This leads a commission agent /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnLoadCommissionAgent(object sender, PropertyChangedEventArgs e) { INotifyTaskCompletion <ICommissionAgent> notification = sender as INotifyTaskCompletion <ICommissionAgent>; if (notification != null && notification.IsSuccessfullyCompleted) { var broker = notification.Task.Result; if (broker == null) { _dialogService.ShowErrorMessage("Loading commission agent error. No real result"); } var brokerId = broker.Value.NUM_COMI; var tabName = brokerId + "." + broker.Value.NOMBRE; Logger.Log(LogLevel.Debug, "[UI] CommissionAgentControlViewModel. Opening Tab: " + brokerId); var navigationParameters = new NavigationParameters(); navigationParameters.Add("Id", brokerId); navigationParameters.Add(ScopedRegionNavigationContentLoader.DefaultViewName, tabName); var uri = new Uri(typeof(CommissionAgentInfoView).FullName + navigationParameters, UriKind.Relative); RegionManager.RequestNavigate("TabRegion", uri); var currentPayload = BuildShowPayLoadDo(tabName, broker); currentPayload.PrimaryKeyValue = brokerId; EventManager.NotifyObserverSubsystem(MasterModuleConstants.CommissionAgentSystemName, currentPayload); ActiveSubSystem(); } else if (notification != null && notification.IsFaulted) { _dialogService?.ShowErrorMessage(notification.ErrorMessage); } }
void SelectedAbilityChanged(object sender, SelectedItemChangedEventArgs<Ability> e) { if (e.NewItem != null) { _cachedAbilityId = e.NewItem.Id; SelectedAbility = NotifyTaskCompletion.Create<Ability>(LoadAbilityAsync(e.NewItem.Id, CurrentVersion.VersionGroup, CurrentLanguage)); } }
public void Setup(INotifyTaskCompletion <IEnumerable <UiSkill> > skillRequestNotifyTaskCompletion = null, INotifyTaskCompletion <object> addSkillCommandNotifyTaskCompletion = null) { SetupStaticFakes(); SetupNotifyTaskCompletions(skillRequestNotifyTaskCompletion, addSkillCommandNotifyTaskCompletion); SetupSkillTableViewModel(); }
public void Setup(INotifyTaskCompletion <IEnumerable <UiPrimaryStat> > dataRequestNotifyTaskCompletion = null) { SetupContantFakes(); SetupNotifyTaskCompletion(dataRequestNotifyTaskCompletion); SetupPrimaryStatsViewModel(); }
protected override void ChangeVersion(GameVersion newVersion) { SelectedAbility = null; base.ChangeVersion(newVersion); if (newVersion != null) Abilities = NotifyTaskCompletionCollection<Ability>.Create(LoadAbilitiesAsync(CurrentVersion.VersionGroup, CurrentLanguage), _cachedAbilityId); //SelectedAbilityChanged(this, new SelectedItemChangedEventArgs<Ability>(null, new Ability { Id = _cachedAbilityId })); }
/// <summary> /// This execute the payload and notify the event manager /// </summary> /// <param name="services">Services to be used</param> /// <param name="manager">Manager to be notified</param> /// <param name="payLoad">Payload to execute.</param> public override void ExecutePayload(IDataServices services, IEventManager manager, ref DataPayLoad payLoad) { _dataServices = services.GetSupplierDataServices(); _payload = payLoad; EventManager = manager; DataServices = services; _initializationNotifier = NotifyTaskCompletion.Create <DataPayLoad>(HandleSaveOrUpdate(_payload), ExecutedPayloadHandler); }
void SelectedMoveChanged(object sender, SelectedItemChangedEventArgs <ModelNameBase> e) { CurrentMove = null; if (e.NewItem != null) { CurrentMove = NotifyTaskCompletion.Create(LoadMoveByIdAsync(e.NewItem.Id)); } }
/// <summary> /// Load event. /// </summary> /// <param name="value"></param> public void Load(string value) { if (string.IsNullOrEmpty(value)) { return; } _initializationNotifier = NotifyTaskCompletion.Create(LoadDto(value), _loadCompleted); }
/// <summary> /// Start and Notify the load of the control view model table. /// </summary> public void StartAndNotify() { MessageHandlerMailBox += MessageHandler; EventManager.RegisterMailBox(EventSubsystem.ClientSummaryVm, MessageHandlerMailBox); _clientTaskNotify = NotifyTaskCompletion.Create <IEnumerable <ClientSummaryExtended> >(_clientDataServices.GetPagedSummaryDoAsync(1, DefaultPageSize), _clientEventTask); // This is needed for the communication between the view model and the toolbar. ActiveSubSystem(); }
/// <summary> /// This execute a payload. /// </summary> /// <param name="services">Data services to be used for executing the payload</param> /// <param name="manager">Manager to be used for sending messages to the view model</param> /// <param name="payLoad">Payload to be used for sending it.</param> public override void ExecutePayload(IDataServices services, IEventManager manager, ref DataPayLoad payLoad) { _commissionAgentDataServices = services.GetCommissionAgentDataServices(); DataServices = services; _payload = payLoad; EventManager = manager; _initializationNotifier = NotifyTaskCompletion.Create <DataPayLoad>(HandleCommissionAgentSave(_payload), ExecutedPayloadHandler); }
public AsyncCommandWithInput(IAsyncCommandWatcher <object> asyncCommandWatcher, Func <TIn, Task> command, INotifyTaskCompletion <object> notifyTaskCompletion, ITaskWrapper taskWrapper) : base(asyncCommandWatcher) { _asyncCommandWatcher = asyncCommandWatcher; _command = command; _notifyTaskCompletion = notifyTaskCompletion; _taskWrapper = taskWrapper; }
void SelectedAbilityChanged(object sender, SelectedItemChangedEventArgs <Ability> e) { if (e.NewItem != null) { _cachedAbilityId = e.NewItem.Id; SelectedAbility = NotifyTaskCompletion.Create <Ability>(LoadAbilityAsync(e.NewItem.Id, CurrentVersion.VersionGroup, CurrentLanguage)); } }
public void Setup() { _notifyTaskCompletion = A.Fake <INotifyTaskCompletion <int> >(); _asyncCommandWatcher = A.Fake <IAsyncCommandWatcher <int> >(); _command = async() => 0; _asyncSimpleCommand = new AsyncResultCommand <int>(_asyncCommandWatcher, _command, _notifyTaskCompletion); }
void SelectedFormChanged(object sender, SelectedItemChangedEventArgs <ModelNameBase> e) { CurrentForm = null; if (e.NewItem != null) { _cachedFormId = e.NewItem.Id; CurrentForm = NotifyTaskCompletion.Create <PokemonForm>(LoadFormByIdAsync(e.NewItem.Id)); } }
public DriversControlViewModel(IDataServices services, IRegionManager manager) : base(services) { _regionManager = manager; _clientDataServices = DataServices.GetClientDataServices(); GoBackCommand = new DelegateCommand(GoBack); GoForwardCommand = new DelegateCommand(GoForward); _drivers = new IncrementalList <ClientSummaryExtended>(LoadMoreItems); _notifyTaskCompletion = NotifyTaskCompletion.Create <IEnumerable <ClientSummaryExtended> >(_clientDataServices.GetPagedSummaryDoAsync(0, DefaultPageSize), PagingEvent); }
/// The ctor has been initialized correctly. /// <summary> /// This execute the data payload received from the toolbar /// </summary> /// <param name="services">DataServices</param> /// <param name="manager">Event manager for communicating between view model</param> /// <param name="payLoad">DataPayload to be executed</param> public override void ExecutePayload(IDataServices services, IEventManager manager, ref DataPayLoad payLoad) { _clientDataServices = services.GetClientDataServices(); _payload = payLoad; EventManager = manager; DataServices = services; // FIXME: move to the parent class. _initializationNotifier = NotifyTaskCompletion.Create <DataPayLoad>(HandleSaveOrUpdate(payLoad), ExecutedPayloadHandler); }
public void Setup() { _notifyTaskCompletion = A.Fake <INotifyTaskCompletion <object> >(); _asyncCommandWatcher = A.Fake <IAsyncCommandWatcher <object> >(); _command = async() => null; _asyncSimpleCommand = new AsyncSimpleCommand(_asyncCommandWatcher, _command, _notifyTaskCompletion); }
public override async Task ExecuteAsync(object parameter) { Execution = NotifyTaskCompletion.Create(_command(_cancelCommand.Token)); RaiseCanExecuteChanged(); await Execution.TaskCompleted; _cancelCommand.NotifyCommandFinished(); RaiseCanExecuteChanged(); }
protected override void ChangeVersion(GameVersion newVersion) { SelectedAbility = null; base.ChangeVersion(newVersion); if (newVersion != null) { Abilities = NotifyTaskCompletionCollection <Ability> .Create(LoadAbilitiesAsync(CurrentVersion.VersionGroup, CurrentLanguage), _cachedAbilityId); } //SelectedAbilityChanged(this, new SelectedItemChangedEventArgs<Ability>(null, new Ability { Id = _cachedAbilityId })); }
private void SetupNotifyTaskCompletion(INotifyTaskCompletion <IEnumerable <UiPrimaryStat> > dataRequestNotifyTaskCompletion) { if (dataRequestNotifyTaskCompletion == null) { dataRequestNotifyTaskCompletion = new NotifyTaskCompletion <IEnumerable <UiPrimaryStat> >(_logger); } _dataRequestNotifyTaskCompletion = dataRequestNotifyTaskCompletion; A.CallTo(() => _fakeNotifyTaskCompletionFactory.Create <IEnumerable <UiPrimaryStat> >()).Returns(_dataRequestNotifyTaskCompletion); }
public MainViewModel() { Initialization(); Ages = new OptimizedFastObservableCollection<AgeViewModel>(SimulationIterationCount); _simulationComplition = NotifyTaskCompletion.Create(DoSimulationAsync()); _simulationComplition.PropertyChanged += (sender, args) => { if (args.PropertyName == "Exception") { var completion = (INotifyTaskCompletion)sender; MessageBox.Show(completion.Exception.ToString(), "Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }; }
public StoreListViewModel(IStoresService storesService, IUserDialogs dialogsService) { _storesService = storesService; _dialogsService = dialogsService; Initialization = NotifyTaskCompletion.Create(RefreshList); }