protected async Task <(DashboardViewItem listViewItem, DashboardViewItem detailViewItem)> ViewItems(XafApplication xafApplication) { var modelDashboardView = NewModelDashboardView(xafApplication); var masterDetailDashoardViewItems = MasterDetailService.MasterDetailDashboardViewItems.Replay(); masterDetailDashoardViewItems.Connect(); var dashboardView = xafApplication.CreateDashboardView(xafApplication.CreateObjectSpace(), modelDashboardView.Id, true); dashboardView.MockCreateControls(); var tuple = await masterDetailDashoardViewItems.FirstAsync(); return(tuple); }
static async Task <DashboardViewItemInfo> ViewItems(XafApplication xafApplication) { var modelDashboardView = xafApplication.Model.NewModelDashboardView(typeof(Md)); var masterDetailDashoardViewItems = xafApplication.WhenMasterDetailDashboardViewItems().Replay(); masterDetailDashoardViewItems.Connect(); var dashboardView = xafApplication.CreateDashboardView(xafApplication.CreateObjectSpace(), modelDashboardView.Id, true); dashboardView.MockCreateControls(); var tuple = await masterDetailDashoardViewItems.FirstAsync().WithTimeOut(); return(new DashboardViewItemInfo() { ListViewItem = tuple.listViewItem, DetailViewItem = tuple.detailViewItem }); }
static View CreateView(this XafApplication application, IModelView viewModel, IObjectSpace objectSpace) { View view = null; switch (viewModel) { case IModelListView listViewModel: { var collectionSource = application.CreateCollectionSource(objectSpace, listViewModel.ModelClass.TypeInfo.Type, listViewModel.Id); view = application.CreateListView(listViewModel, collectionSource, true); break; } case IModelDetailView detailViewModel: view = application.CreateDetailView(objectSpace, detailViewModel, true); break; case IModelDashboardView _: view = application.CreateDashboardView(objectSpace, viewModel.Id, true); break; } return(view); }