private void NavigationService_Navigated(object sender, NavigationEventArgs e) { if (e != null) { var vm = NavigationService.GetNameOfRegisteredPage(e.SourcePageType); ShellNavigationItem navigationItem = null; if (e.Parameter != null) { var page = e.Parameter as FBPage; navigationItem = PrimaryItems?.FirstOrDefault(i => i.ViewModelName == vm && i.Parameter == page); } else { navigationItem = PrimaryItems?.FirstOrDefault(i => i.ViewModelName == vm); if (navigationItem == null) { navigationItem = SecondaryItems?.FirstOrDefault(i => i.ViewModelName == vm); } } if (navigationItem != null) { ChangeSelected(_lastSelectedItem, navigationItem); _lastSelectedItem = navigationItem; } } }
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); }
private async void OnGetPrimaryItems(IReadOnlyList <IStorageItem> items) { foreach (StorageFile item in items) { PrimaryItems.Add(await CustomItemFactory.Create(item)); } }
private async void Frame_Navigated(object sender, NavigationEventArgs e) { if (e != null) { var vm = NavigationService.GetNameOfRegisteredPage(e.SourcePageType); var navigationItem = PrimaryItems?.FirstOrDefault(i => i.ViewModelName == vm); if (navigationItem == null) { navigationItem = SecondaryItems?.FirstOrDefault(i => i.ViewModelName == vm); } if (navigationItem != null) { ChangeSelected(_lastSelectedItem, navigationItem); _lastSelectedItem = navigationItem; } //Sentence 초기화 var init = Singleton <SentenceHelper> .Instance; //마이크로 폰 권한 체크 bool permissionGained = await AudioCapturePermissions.RequestMicrophonePermission(); if (permissionGained) { var speechLanguage = SpeechRecognizer.SystemSpeechLanguage; var langTag = speechLanguage.LanguageTag; var speechContext = ResourceContext.GetForCurrentView(); speechContext.Languages = new[] { langTag }; } } }
private void NavigationService_Navigated(object sender, NavigationEventArgs e) { if (e != null) { var vm = NavigationService.GetNameOfRegisteredPage(e.SourcePageType); var navigationItem = PrimaryItems?.FirstOrDefault(i => i.ViewModelName == vm); if (navigationItem == null) { navigationItem = SecondaryItems?.FirstOrDefault(i => i.ViewModelName == vm); } if (navigationItem != null) { ChangeSelected(_lastSelectedItem, navigationItem); _lastSelectedItem = navigationItem; } if (navigationItem == null && CurrentFrameViewModel != null) { (CurrentFrameViewModel as ShellNavigationItem).IsSelected = false; } CurrentFrameViewModel = navigationItem; } }
protected override void CreateSelectionAppBarButtons() { base.CreateSelectionAppBarButtons(); PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_SelectAll_Text"], Icon = new FontIcon { Glyph = "\uE0E7" }, Command = SelectAllCommand }); if (LastPivotIndex == 1 && UserId == _inTouch.Session.UserId) { SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Delete_Text"], Command = DeleteSelectedCommand }); } else { SecondaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_AddToMyVideos_Text"], Command = AddSelectedToMyVideosCommand }); } }
private void frame_Navigated(object sender, NavigationEventArgs e) { if (e != null) { var vm = e.SourcePageType.ToString().Split('.').Last().Replace("Page", string.Empty); var navigationItem = PrimaryItems?.FirstOrDefault(i => i.PageIdentifier == vm); if (navigationItem == null) { navigationItem = SecondaryItems?.FirstOrDefault(i => i.PageIdentifier == vm); } if (navigationItem == null) { navigationItem = OtherItems?.FirstOrDefault(i => i.PageIdentifier == vm); } if (navigationItem != null) { changeSelected(lastSelectedItem, navigationItem); lastSelectedItem = navigationItem; Header = navigationItem.Label; } } }
private void PopulateNavItems() { //^^ //{[{ PrimaryItems.Add(new ShellNavigationItem("Shell_wts.ItemName".GetLocalized(), Symbol.Document, typeof(wts.ItemNameViewModel))); //}]} }
/// <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 Frame_Navigated(object sender, NavigationEventArgs e) { var navigationItem = PrimaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType); if (navigationItem != null) { ChangeSelected(_lastSelectedItem, navigationItem); _lastSelectedItem = navigationItem; } }
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))); }
private async void OnGetPrimaryItems(IReadOnlyList <IStorageItem> items) { foreach (StorageFile item in items) { PrimaryItems.Add(new CustomItem { Path = item.Path, FileName = item.Name, Image = await GetImageOrDefaultAsync(item), OriginalStorageItem = item }); } }
/// <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)); }
private void Frame_Navigated(object sender, NavigationEventArgs e) { if (e != null) { var vm = NavigationService.GetNameOfRegisteredPage(e.SourcePageType); var navigationItem = PrimaryItems?.FirstOrDefault(i => i.ViewModelName == vm); if (navigationItem != null) { ChangeSelected(_lastSelectedItem, navigationItem); _lastSelectedItem = navigationItem; } } }
private void NavigationService_Navigated(object sender, NavigationEventArgs e) { var item = PrimaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType); if (item == null) { item = SecondaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType); } if (item != null) { ChangeSelected(_lastSelectedItem, item); _lastSelectedItem = item; } }
private void Publisher_InvokeItemEvent(object sender, Symbol itemName) { var navigationItem = PrimaryItems?.FirstOrDefault(i => i.Symbol == itemName); if (navigationItem == null) { navigationItem = SecondaryItems?.FirstOrDefault(i => i.Symbol == itemName); } if (navigationItem != null) { //ChangeSelected(_lastSelectedItem, navigationItem); //_lastSelectedItem = navigationItem; this.Navigate(navigationItem); } }
/// <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)); }
private void Frame_Navigated(object sender, NavigationEventArgs e) { if (e != null) { var vm = e.SourcePageType.FullName; var navigationItem = PrimaryItems?.FirstOrDefault(i => i.ViewModelName == vm); if (navigationItem == null) { navigationItem = SecondaryItems?.FirstOrDefault(i => i.ViewModelName == vm); } if (navigationItem != null) { ChangeSelected(_lastSelectedItem, navigationItem); _lastSelectedItem = navigationItem; } } }
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 }); }
private void NavigationService_Navigated(object sender, NavigationEventArgs e) { if (e != null) { var viewType = _navigationService.CurrentSourcePageType; var viewModelType = ViewModelLocator.LocateTypeForViewType(viewType, false); var navigationItem = PrimaryItems?.FirstOrDefault(i => i.ViewModelType == viewModelType); if (navigationItem == null) { navigationItem = SecondaryItems?.FirstOrDefault(i => i.ViewModelType == viewModelType); } if (navigationItem != null) { ChangeSelected(_lastSelectedItem, navigationItem); _lastSelectedItem = navigationItem; } } }
protected override void CreateDefaultAppBarButtons() { base.CreateDefaultAppBarButtons(); PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Select_Text"], Icon = new FontIcon { Glyph = "\uE133", FontSize = 14 }, Command = ActivateSelectionModeCommand }); PrimaryItems.Add(new AppBarButton { Label = _locService["AppBarButton_Filter_Text"], Icon = new FontIcon { Glyph = "\uE16E", FontSize = 14 }, Command = ShowPerformerFlyoutCommand }); }
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, "Main")); PrimaryItems.Add(new ShellNavigationItem("Shell_WebView".GetLocalized(), Symbol.Document, "WebView")); PrimaryItems.Add(new ShellNavigationItem("Shell_MediaPlayer".GetLocalized(), Symbol.Document, "MediaPlayer")); PrimaryItems.Add(new ShellNavigationItem("Shell_MasterDetail".GetLocalized(), Symbol.Document, "MasterDetail")); PrimaryItems.Add(new ShellNavigationItem("Shell_Grid".GetLocalized(), Symbol.Document, "Grid")); PrimaryItems.Add(new ShellNavigationItem("Shell_Chart".GetLocalized(), Symbol.Document, "Chart")); PrimaryItems.Add(new ShellNavigationItem("Shell_Tabbed".GetLocalized(), Symbol.Document, "Tabbed")); PrimaryItems.Add(new ShellNavigationItem("Shell_Map".GetLocalized(), Symbol.Document, "Map")); PrimaryItems.Add(new ShellNavigationItem("Shell_Camera".GetLocalized(), Symbol.Document, "Camera")); PrimaryItems.Add(new ShellNavigationItem("Shell_ImageGallery".GetLocalized(), Symbol.Document, "ImageGallery")); SecondaryItems.Add(new ShellNavigationItem("Shell_Settings".GetLocalized(), Symbol.Document, "Settings")); }
/// <summary> /// 添加菜单入口点到主要页面中。 /// </summary> /// <param name="title">入口点菜单的标题。</param> /// <param name="dest">目标页面的类名称,将通过反射创建实例。</param> /// <param name="icon">UWP 的图标。</param> /// <param name="cg">学校命名空间,如果为空默认为全局类。</param> /// <param name="sel">是否被默认选中。</param> /// <param name="apple">iOS 系统展示的图标。为空时收起到信息查询中。</param> public void AddMenuEntry(string title, string dest, string icon, string cg = "", bool sel = false, string apple = "") { var item = new MasterPageItem(title, dest, icon, sel, cg); PrimaryItems.Add(item); #if __IOS__ if (apple != "") { AppleItems.Add(item); item.AppleIcon = new FileImageSource { File = apple }; } else { InAppEntrance.Add(new TapEntranceWrapper(item.Title, item.Title + "的入口。", (nav) => nav.PushAsync(item.CorePage) )); } #endif }
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(PrismUnityApplication.Current.Container.Resolve <ShellNavigationViewModel>(new ResolverOverride[] { new ParameterOverride("label", "MyMusic".GetLocalized()), new ParameterOverride("symbol", "\uE189"), new ParameterOverride("pageIdentifier", "MyMusic") })); PrimaryItems.Add(PrismUnityApplication.Current.Container.Resolve <ShellNavigationViewModel>(new ResolverOverride[] { new ParameterOverride("label", "Playlists".GetLocalized()), new ParameterOverride("symbol", "\uE90B"), new ParameterOverride("pageIdentifier", "Playlist") })); PrimaryItems.Add(PrismUnityApplication.Current.Container.Resolve <ShellNavigationViewModel>(new ResolverOverride[] { new ParameterOverride("label", "Favorites".GetLocalized()), new ParameterOverride("symbol", "\uEB51"), new ParameterOverride("pageIdentifier", "Favorite") })); PrimaryItems.Add(PrismUnityApplication.Current.Container.Resolve <TuneInNavigationViewModel>(new ResolverOverride[] { new ParameterOverride("label", "TuneIn".GetLocalized()), new ParameterOverride("symbol", "\uEC05"), new ParameterOverride("pageIdentifier", "Radio") })); SecondaryItems.Add(PrismUnityApplication.Current.Container.Resolve <ManageZonesNavigationViewModel>(new ResolverOverride[] { new ParameterOverride("symbol", "\uE965"), new ParameterOverride("pageIdentifier", "Zone"), new ParameterOverride("secondPageIdentifier", "ManageZones") })); OtherItems.Add(PrismUnityApplication.Current.Container.Resolve <ShellNavigationViewModel>(new ResolverOverride[] { new ParameterOverride("label", "Settings".GetLocalized()), new ParameterOverride("symbol", "\uE115"), new ParameterOverride("pageIdentifier", "Settings") })); }
internal void UpdateItems() { _bar.RemoveAllViews(); if (SecondaryItems != null) { foreach (var control in SecondaryItems.Select(item => DroidFactory.GetNativeObject <Android.Views.View>(item, "item")).Where(item => item != null)) { _bar.AddView(control); } } if (PrimaryItems == null || !PrimaryItems.Any()) { return; } { _bar.AddView(new Android.Views.View(Context), new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1)); foreach (var control in PrimaryItems.Select(item => DroidFactory.GetNativeObject <Android.Views.View>(item, "item")).Where(item => item != null)) { _bar.AddView(control); } } }
/// <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 }); } }