public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary <string, object> viewModelState, bool suspending) { if (e.NavigationMode == NavigationMode.Back && _appLoaderService.IsShowed) { e.Cancel = true; return; } if (e.NavigationMode == NavigationMode.Back && IsSelectionMode) { SetDefaultMode(); e.Cancel = true; return; } if (e.NavigationMode == NavigationMode.New) { viewModelState[nameof(Videos)] = JsonConvert.SerializeObject(Videos.ToList()); viewModelState[nameof(_offset)] = _offset; } PrimaryItems.Clear(); SecondaryItems.Clear(); base.OnNavigatingFrom(e, viewModelState, suspending); }
/// <summary> /// Populates the nav items. /// </summary> protected override void PopulateNavItems() { PrimaryItems.Clear(); PrimaryItems.Add(new NavigationItem("Unlist Nuget packages", Application.Current.Resources["validation"] as string, ForegroundColor, Unlist_Command)); SecondaryItems.Clear(); SecondaryItems.Add(new NavigationItem("Help", Application.Current.Resources["help"] as string, ForegroundColor, Help_Command)); }
private void CreateDefaultAppBarButtons() { PrimaryItems.Clear(); SecondaryItems.Clear(); if (LastPivotIndex == 0) { PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Shuffle_Text"], Icon = new FontIcon { Glyph = "\uE14B" }, Command = PlayShuffleCommand }); } PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Refresh_Text"], Icon = new FontIcon { Glyph = "\uE117", FontSize = 14 }, Command = ReloadContentCommand }); if (LastPivotIndex != 1) { PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Select_Text"], Icon = new FontIcon { Glyph = "\uE133", FontSize = 14 }, Command = ActivateSelectionMode }); } if (_launchViewResolver.LaunchViewName != AppConstants.DEFAULT_MAIN_VIEW) { PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Home_Text"], Icon = new FontIcon { Glyph = "\uE10F" }, Command = OpenMainViewCommand }); } SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_TransferManager_Text"], Command = OpenTransferManagerCommand }); }
private void PopulateNavItems() { PrimaryItems.Clear(); SecondaryItems.Clear(); // TODO WTS: Change the symbols for each item as appropriate for your app // More on Segoe UI Symbol icons: https://docs.microsoft.com/windows/uwp/style/segoe-ui-symbol-font // Or to use an IconElement instead of a Symbol see https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/projectTypes/navigationpane.md // Edit String/en-US/Resources.resw: Add a menu item title for each page }
private void PopulateNavItems() { PrimaryItems.Clear(); SecondaryItems.Clear(); // TODO WTS: Change the symbols for each item as appropriate for your app // More on Segoe UI Symbol icons: https://docs.microsoft.com/windows/uwp/style/segoe-ui-symbol-font // Or to use an IconElement instead of a Symbol see https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/projectTypes/navigationpane.md // Edit String/en-US/Resources.resw: Add a menu item title for each page PrimaryItems.Add(new ShellNavigationItem("Shell_Main".GetLocalized(), Symbol.Document, typeof(MainViewModel))); SecondaryItems.Add(new ShellNavigationItem("Shell_Settings".GetLocalized(), Symbol.Setting, typeof(SettingsViewModel))); }
/// <summary> /// Populates the nav items. /// </summary> protected override void PopulateNavItems() { PrimaryItems.Clear(); PrimaryItems.Add(new NavigationItem("Info", Application.Current.Resources["info"] as string, ForegroundColor, Info_Command)); PrimaryItems.Add(new NavigationItem("Editable Combobox", Application.Current.Resources["combobox"] as string, ForegroundColor, EditableCombo_Command)); PrimaryItems.Add(new NavigationItem("Validation", Application.Current.Resources["validation"] as string, ForegroundColor, ValidationTest_Command)); PrimaryItems.Add(new NavigationItem("Unit Conversion", Application.Current.Resources["weight"] as string, ForegroundColor, UnitConversion_Command)); SecondaryItems.Clear(); SecondaryItems.Add(new NavigationItem("Help", Application.Current.Resources["help"] as string, ForegroundColor, Help_Command)); SecondaryItems.Add(new NavigationItem("Language", Application.Current.Resources["flag"] as string, ForegroundColor, Language_Command)); SecondaryItems.Add(new NavigationItem("Color", Application.Current.Resources["color"] as string, ForegroundColor, Color_Command)); SecondaryItems.Add(new NavigationItem(Context.IsAuthenticated ? "Logout" : "Login", Application.Current.Resources["user2"] as string, ForegroundColor, Login_Command)); }
/// <summary> /// Populates the nav items. /// </summary> protected override void PopulateNavItems() { PrimaryItems.Clear(); PrimaryItems.Add(new NavigationItem("SlideShow", Application.Current.Resources["kiosk"] as string, ForegroundColor, Display_Command)); PrimaryItems.Add(new NavigationItem("Info", Application.Current.Resources["info"] as string, ForegroundColor, Info_Command)); PrimaryItems.Add(new NavigationItem("Browse", Application.Current.Resources["search"] as string, ForegroundColor, Browse_Command)); PrimaryItems.Add(new NavigationItem("Converters", Application.Current.Resources["products"] as string, ForegroundColor, Converter_Command)); PrimaryItems.Add(new NavigationItem("Selection", Application.Current.Resources["multiselect"] as string, ForegroundColor, SelectionTest_Command)); PrimaryItems.Add(new NavigationItem("ListView", Application.Current.Resources["products"] as string, ForegroundColor, ListViewTest_Command)); PrimaryItems.Add(new NavigationItem("Validation", Application.Current.Resources["Validation"] as string, ForegroundColor, ValidationTest_Command)); SecondaryItems.Clear(); SecondaryItems.Add(new NavigationItem("Help", Application.Current.Resources["help"] as string, ForegroundColor, Help_Command)); SecondaryItems.Add(new NavigationItem("Language", Application.Current.Resources["flag"] as string, ForegroundColor, Language_Command)); SecondaryItems.Add(new NavigationItem("Theme", Application.Current.Resources["color"] as string, ForegroundColor, Color_Command)); SecondaryItems.Add(new NavigationItem(Context.IsAuthenticated ? "Logout" : "Login", Application.Current.Resources["user2"] as string, ForegroundColor, Login_Command)); }
protected virtual void CreateDefaultAppBarButtons() { PrimaryItems.Clear(); SecondaryItems.Clear(); PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Refresh_Text"], Icon = new FontIcon { Glyph = "\uE117", FontSize = 14 }, Command = ReloadCommand }); SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_TransferManager_Text"], Command = OpenTransferManagerCommand }); }
/// <summary> /// 根据现有的预定义菜单内容添加入口点。 /// </summary> private void FetchOptions() { PrimaryItems.Clear(); SecondaryItems.Clear(); SecondaryItems.Add(new MasterPageItem("设置", "SettingPage")); #if __IOS__ AppleItems.Clear(); InAppEntrance.Clear(); var settingList = new InfoEntranceGroup("设置") { new TapEntranceWrapper("设置", "调整程序运行的参数。", (nav) => nav.PushAsync(SecondaryItems[0].CorePage)), new TapEntranceWrapper("关于", "程序的版本信息、开发人员、许可证和隐私声明等。", (nav) => nav.PushAsync(new AboutPage())), }; #endif AddMenuEntry("首页", "IndexPage", "\xE10F", sel: true, apple: "tab_rec.png"); AddMenuEntry("课程表", "SchedulePage", "\xECA5", apple: "tab_sched.png"); #if !__ANDROID__ if (Core.App.Feed != null) { AddMenuEntry("学校通知", "FeedPage", "\xED0D", apple: "tab_feed.png"); } if (Core.App.Message != null) { AddMenuEntry("站内消息", "MessagePage", "\xE715"); } #else if (Core.App.Feed != null && Core.App.Message != null) { AddMenuEntry("消息通知", "MessageTabbedPage", "\xE715"); } else if (Core.App.Feed != null) { AddMenuEntry("学校通知", "FeedPage", "\xED0D"); } else if (Core.App.Message != null) { AddMenuEntry("站内消息", "MessagePage", "\xE715"); } #endif if (Core.App.GradePoint != null) { AddMenuEntry("学分成绩", "GradePointPage", "\xE82D"); } if (Core.App.InfoEntrances.Count > 0 || Core.RuntimePlatform == "iOS") { AddMenuEntry("信息查询", "InfoQueryPage", "\xE946", apple: "tab_about.png"); } #if __IOS__ if (InAppEntrance.Count > 0) { Core.App.InfoEntrances.Insert(0, InAppEntrance); } Core.App.InfoEntrances.Add(settingList); #endif }
protected virtual void CreateSelectionAppBarButtons() { PrimaryItems.Clear(); SecondaryItems.Clear(); }
private void CreateSelectionAppBarButtons() { PrimaryItems.Clear(); SecondaryItems.Clear(); PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Download_Text"], Icon = new FontIcon { Glyph = "\uE118" }, Command = DownloadSelectedCommand }); PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Play_Text"], Icon = new FontIcon { Glyph = "\uE102" }, Command = PlaySelectedCommand }); PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_SelectAll_Text"], Icon = new FontIcon { Glyph = "\uE0E7" }, Command = SelectAllCommand }); if (_userID != 0 && _userID != _vkLoginService.UserID) { switch (LastPivotIndex) { case 0: SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_AddToMyAudios_Text"], Command = AddSelectedToMyCollectionCommand }); break; case 1: SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_AddToMyVideos_Text"], Command = AddSelectedToMyCollectionCommand }); break; case 2: SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_AddToMyDocs_Text"], Command = AddSelectedToMyCollectionCommand }); break; } } else { SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Delete_Text"], Command = DeleteSelectedCommand }); } }
public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary <string, object> viewModelState, bool suspending) { if (e.NavigationMode == NavigationMode.Back && _appLoaderService.IsShowed) { e.Cancel = true; _cancelOperations = true; _appLoaderService.Hide(); return; } if (e.NavigationMode == NavigationMode.Back && IsSelectionMode) { SetDefaultMode(); e.Cancel = true; return; } if (e.NavigationMode == NavigationMode.New) { var audioAlbums = AudioGroup.FirstOrDefault(g => (string)g.Key == "albums"); var audios = AudioGroup.FirstOrDefault(g => (string)g.Key == "audios"); if (audios != null) { audios.CollectionChanged -= Downloadable_CollectionChanged; viewModelState["Audios"] = JsonConvert.SerializeObject(audios.ToList()); } if (audioAlbums != null) { viewModelState["AudioAlbums"] = JsonConvert.SerializeObject(audioAlbums.ToList()); } var videoAlbums = VideoGroup.FirstOrDefault(g => (string)g.Key == "albums"); var videos = VideoGroup.FirstOrDefault(g => (string)g.Key == "videos"); if (videos != null) { viewModelState["Videos"] = JsonConvert.SerializeObject(videos.ToList()); } if (videoAlbums != null) { viewModelState["VideoAlbums"] = JsonConvert.SerializeObject(videoAlbums.ToList()); } Documents.CollectionChanged -= Downloadable_CollectionChanged; viewModelState[nameof(Documents)] = JsonConvert.SerializeObject(Documents.ToList()); viewModelState[nameof(LastPivotIndex)] = LastPivotIndex; viewModelState[nameof(PageTitle)] = PageTitle; viewModelState[nameof(_audiosOffset)] = _audiosOffset; viewModelState[nameof(_audioAlbumsOffset)] = _audioAlbumsOffset; viewModelState[nameof(_videosOffset)] = _videosOffset; viewModelState[nameof(_videoAlbumsOffset)] = _videoAlbumsOffset; viewModelState[nameof(_docsOffset)] = _docsOffset; viewModelState[nameof(AudiosScrollPosition)] = AudiosScrollPosition; viewModelState[nameof(VideosScrollPosition)] = VideosScrollPosition; viewModelState[nameof(DocsScrollPosition)] = DocsScrollPosition; } if (!suspending) { PrimaryItems.Clear(); SecondaryItems.Clear(); SelectedItems.Clear(); } base.OnNavigatingFrom(e, viewModelState, suspending); }