Ejemplo n.º 1
0
        private void GenerateReport()
        {
            BusyViewModel.ActiveAsync("... Generating ...")
            .Then(() => Items.ClearAsync(), Scheduler.Dispatcher.TPL)
            .Then(() => Service.GenerateAsync(Service.CreateRequest(ParameterViewModel)), Scheduler.Task.TPL)
            .Do(response => _response = response, Scheduler.Task.TPL)
            .Then(response => Service.GenerateDataViewModelsAsync(response), Scheduler.Task.TPL)
            .Do(dataViewModels =>
            {
                foreach (var dataViewModel in dataViewModels)
                {
                    Items.Add(dataViewModel);

                    var supportActivationState = dataViewModel as ISupportActivationState;
                    if (supportActivationState != null)
                    {
                        this.SyncViewModelActivationStates(supportActivationState).AddDisposable(Disposables);
                    }
                }
            }, Scheduler.Dispatcher.TPL)
            .LogException(Log)
            .CatchAndHandle(x => StandardDialog.Error("Error", "Problem Generating Report"), Scheduler.Task.TPL)
            .Finally(() =>
            {
                BusyViewModel.InActive();

                IsExpanded = false;

                _exportToExcel.RaiseCanExecuteChanged();
            }, Scheduler.Task.TPL);
        }
Ejemplo n.º 2
0
 protected override Task OnInitialise()
 {
     return(BusyViewModel.ActiveAsync("Loading")
            .Then(() => _service.GetGendersAsync(), Scheduler.Task.TPL)
            .Do(genders => Genders.AddRangeAsync(genders), Scheduler.Dispatcher.TPL)
            .Finally(() => BusyViewModel.InActive(), Scheduler.Dispatcher.TPL));
 }
Ejemplo n.º 3
0
 private void Save()
 {
     BusyViewModel.ActiveAsync("... Saving Quote ...")
     .Then(() => _service.SaveQuoteAsync(Model), Scheduler.Task.TPL)
     .LogException(Log)
     .CatchAndHandle(_ => StandardDialog.Error("Error", "Problem saving quote"), Scheduler.Task.TPL)
     .Finally(() =>
     {
         BusyViewModel.InActive();
         ClosingStrategy.Close();
     }, Scheduler.Task.TPL);
 }
Ejemplo n.º 4
0
        private void ExportToExcel()
        {
            BusyViewModel.ActiveAsync("... Exporting to Excel ...")
            .Do(() => Service.ExportToExcel(_response), Scheduler.Task.TPL)
            .LogException(Log)
            .CatchAndHandle(x => StandardDialog.Error("Error", "Problem Exporting to Excel"), Scheduler.Task.TPL)
            .Finally(() =>
            {
                BusyViewModel.InActive();

                IsExpanded = false;
            }, Scheduler.Task.TPL);
        }