private async void NavigationRootPage_Loaded(object sender, RoutedEventArgs e) { if (navigationRootViewModel != null) { await navigationRootViewModel.InitCategoryPngs(); //获取类别展示数据 navigationRootViewModel.GetCFCommonCollection(); //获取底部展示数据 navigationRootViewModel.GetCFBottomCollection(); //默认选中第一条 lvCommonCategory.SelectedIndex = 0; } }
public NavigationRootPage() { this.InitializeComponent(); if (navigationRootViewModel == null) { if (!SimpleIoc.Default.IsRegistered <NavigationRootViewModel>()) { SimpleIoc.Default.Register <NavigationRootViewModel>(); } navigationRootViewModel = SimpleIoc.Default.GetInstance <NavigationRootViewModel>(); } this.DataContext = navigationRootViewModel; this.Loaded += async(ss, ee) => { if (!AppEnvironment.IsPhone) { this.rootFrame.Margin = new Thickness(-1, -1, -0.5, -0.5); this.appBarRefreshBtn.Visibility = Visibility.Visible; InitZoomSemanticButtonMessenger(); } else { this.rootFrame.Margin = new Thickness(0, 0, 0, 0); this.appBarRefreshBtn.Visibility = Visibility.Collapsed; } InitFavoriteMessenger(); InitDownloadMessenger(); InitVideoMessenger(); InitRankSelectedNameMessenger(); if (navigationRootViewModel != null) { await navigationRootViewModel.InitCategoryPngs(); //获取类别展示数据 navigationRootViewModel.GetEyeSightCommonCollection(); //获取底部展示数据 navigationRootViewModel.GetEyeSightBottomCollection(); //默认选中第一条 lvCommonCategory.SelectedIndex = 0; } }; this.Unloaded += (ss, ee) => { Messenger.Default.Unregister(this); if (AppEnvironment.IsPhone) { LeftSliderGuestureBox.Instance.HideLeftSliderGuestureUIControl(); } }; }