private async void OnOpenDetailView(OpenSearchDetailViewEventArgs args) { var detailViewModel = _searchDetailViewModelCreator[args.ViewModelName]; //SearchNavigationViewModel.SearchResult try { if (args.ViewModelName == "SearchResultViewModel") { var vm = (SearchResultViewModel)detailViewModel; vm.Condition = args.Condition; vm.Id = args.Id; vm.Load( ); } else { await detailViewModel.LoadAsync(args.Id); } } catch { await _messageDialogService.ShowInfoDialogAsync("Info"); await SearchNavigationViewModel.LoadAsync(); return; } SearchDetailViewModels.Add(detailViewModel); //} SelectedSearchDetailViewModel = detailViewModel; }
private async void OnOpenDetailDriveView(OpenSearchDetailDriveViewEventArgs args) { IDetailViewModel detailViewModel = SearchDetailViewModels .SingleOrDefault(vm => vm.Id == args.Id && vm.GetType().Name == args.ViewModelName); if (detailViewModel == null) { //TODO: Разобраться что куда Изменить алгоритм поиска detailViewModel = _searchDetailViewModelCreator[args.ViewModelName]; //; //SearchNavigationViewModel.SearchResult try { await detailViewModel.LoadAsync(args.Id); } catch { await _messageDialogService.ShowInfoDialogAsync("Info"); await SearchNavigationViewModel.LoadAsync(); return; } try { App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE { SearchDetailViewModels.Add(detailViewModel); }); } catch (Exception e) { var x = e.Message; return; } } SelectedSearchDetailViewModel = detailViewModel; }
public async Task LoadAsync() { await SearchNavigationViewModel.LoadAsync(); }
public void Load() { SearchNavigationViewModel.Load(); // SearchResultViewModel.Load(); }