Ejemplo n.º 1
0
        protected override async Task OnInitialization()
        {
            await base.OnInitialization();

            _companyEditor        = CreateViewModel <ICompanyEditor>();
            _companyEditor.Saved += CompanyEditorSaved;

            _branchEditor      = CreateViewModel <IBranchEditor>();
            _companyRepository = GetRepository <ICompanyRepository>();

            async Task LoadCompanies()
            {
                Companies = await _companyRepository.GetItemsWithDetails().ToAsyncObservableCollection();

                Companies.BindToRepositoryChanges(_companyRepository);
            }

            async Task InitializeBranchViewer()
            {
                BranchViewer = await InitializeViewModel <IBranchViewer>();
            }

            try
            {
                await Task.WhenAll(LoadCompanies(), InitializeBranchViewer());
            }
            catch (Exception e)
            {
                throw;
            }
        }