示例#1
0
        private void Frame_Navigated(object sender, NavigationEventArgs e)
        {
            var navigationItem = PrimaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType);

            if (navigationItem == null)
            {
                navigationItem = SecondaryItems?.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, "Main"));
            PrimaryItems.Add(new ShellNavigationItem("Shell_Blank1".GetLocalized(), Symbol.Document, "Blank1"));
            PrimaryItems.Add(new ShellNavigationItem("Shell_Blank2".GetLocalized(), Symbol.Document, "Blank2"));
            PrimaryItems.Add(new ShellNavigationItem("Shell_Blank3".GetLocalized(), Symbol.Document, "Blank3"));
            SecondaryItems.Add(new ShellNavigationItem("Shell_Settings".GetLocalized(), Symbol.Document, "Settings"));
        }
        public override Task Initialize()
        {
            Items.Add(new MainMenuItemViewModel(LogProvider, NavigationService)
            {
                DisplayName         = "Find and Replace",
                TargetViewModelType = typeof(SearchAndReplaceViewModel)
            });

            SecondaryItems.Add(new MainMenuItemViewModel(LogProvider, NavigationService)
            {
                DisplayName         = "Settings",
                TargetViewModelType = typeof(SettingsViewModel)
            });

            return(Task.CompletedTask);
        }
        /// <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));
        }
示例#5
0
        protected override void CreateSelectionAppBarButtons()
        {
            base.CreateSelectionAppBarButtons();

            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 (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_AddToMyAudios_Text"],
                    Command = AddSelectedToMyAudiosCommand
                });
            }
        }
示例#6
0
        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)
                {
                    navigationItem = SecondaryItems?.FirstOrDefault(i => i.ViewModelName == vm);
                }

                if (navigationItem != null)
                {
                    ChangeSelected(_lastSelectedItem, navigationItem);
                    _lastSelectedItem = navigationItem;
                }
            }
        }
        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)
                {
                    ChangeSelected(_lastSelectedItem, navigationItem);
                    _lastSelectedItem = navigationItem;
                }
            }
        }
示例#8
0
        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
            });
        }
示例#9
0
        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"));
        }
示例#10
0
        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")
            }));
        }
示例#11
0
        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);
                }
            }
        }
示例#12
0
        /// <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
        }
示例#13
0
 protected virtual void CreateSelectionAppBarButtons()
 {
     PrimaryItems.Clear();
     SecondaryItems.Clear();
 }
示例#14
0
 protected override void OnReloadContentCommand()
 {
     AppBarItems.Clear();
     SecondaryItems.Clear();
     VKTracks.Refresh();
 }
示例#15
0
        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
                });
            }
        }
示例#16
0
        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);
        }