public async Task ShowExpenseReportAsync(ExpenseReportViewModel expenseReportViewModel)
        {
            await DependencyService.Get <IViewService>().ExecuteBusyActionAsync(
                async() =>
            {
                var serviceFactory = DependencyService.Get <IServiceFactory>();
                //TODO:
                expenseReportViewModel.EmployeeId = App.EmployeeId;

                var editReportVM = new EditExpenseReportViewModel(serviceFactory)
                {
                    ExpenseReport = expenseReportViewModel,
                };
                AddChargesViewModel addChargesVM = new AddChargesViewModel(serviceFactory);
                await addChargesVM.LoadChargesAsync();
                editReportVM.AddCharges = addChargesVM;

                ExpenseReportChargesViewModel associatedChargesVM = new ExpenseReportChargesViewModel(serviceFactory);
                await associatedChargesVM.LoadChargesAsync(expenseReportViewModel.ExpenseReportId);
                editReportVM.AssociatedCharges = associatedChargesVM;

                await Navigation?.PushAsync(new ExpenseReportDetailPage()
                {
                    ViewModel = editReportVM
                }, true);
            });
        }
Exemple #2
0
        public async void ShowExpenseReportAsync(ExpenseReportViewModel expenseReportViewModel)
        {
            await this.ViewService.ExecuteBusyActionAsync(
                async() =>
            {
                var editReportVM           = new EditExpenseReportViewModel();
                editReportVM.ExpenseReport = expenseReportViewModel;

                AddChargesViewModel addChargesVM = new AddChargesViewModel();
                await addChargesVM.LoadChargesAsync();
                editReportVM.AddCharges = addChargesVM;

                ExpenseReportChargesViewModel associatedChargesVM = new ExpenseReportChargesViewModel();
                await associatedChargesVM.LoadChargesAsync(expenseReportViewModel.ExpenseReportId);
                editReportVM.AssociatedCharges = associatedChargesVM;

                this.CurrentViewModel = editReportVM;
            });
        }