Exemplo n.º 1
0
        private void NavigationView_ItemInvoked(Lib.NavigationView sender, Lib.NavigationViewItemInvokedEventArgs args)
        {
            if (args.InvokedItemContainer.Tag is string str)
            {
                if (_pages.TryGetValue(str, out var type))
                {
                    var transitionInfo = args.RecommendedNavigationTransitionInfo;
                    var currentIndex   = _pages.Values.ToList().IndexOf(frame.CurrentSourcePageType);
                    var newIndex       = _pages.Keys.ToList().IndexOf(str);

                    if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
                    {
                        if (newIndex > currentIndex)
                        {
                            transitionInfo = new SlideNavigationTransitionInfo()
                            {
                                Effect = SlideNavigationTransitionEffect.FromRight
                            };
                        }
                        else if (newIndex < currentIndex)
                        {
                            transitionInfo = new SlideNavigationTransitionInfo()
                            {
                                Effect = SlideNavigationTransitionEffect.FromLeft
                            };
                        }
                    }

                    frame.Navigate(type, null, transitionInfo);
                }
            }
        }
Exemplo n.º 2
0
        private void ButtonEmloyeeSettings_Click(object sender, RoutedEventArgs e)
        {
            if (sender is Button button && button?.Tag is string tag)
            {
                var navigationTransitionInfo = new SlideNavigationTransitionInfo
                {
                    Effect = SlideNavigationTransitionEffect.FromLeft
                };

                if (tag == "Current")
                {
                    NavigateToSettingsPage(LocalClient.Employee, navigationTransitionInfo);
                }

                /*else if (tag == "Import" && button.DataContext is EmployeeModel employee)
                 * {
                 *  var dialog = new PasswordDialog();
                 *  var dialogResult = await dialog.ShowAsync();
                 *  if (dialogResult == ContentDialogResult.Primary)
                 *  {
                 *      if (dialog.Password == employee.Password)
                 *      {
                 *          NavigateToSettingsPage(employee, navigationTransitionInfo);
                 *      }
                 *  }
                 * }*/
            }
        }
Exemplo n.º 3
0
 private void NavigateToSettingsPage(EmployeeModel employee, SlideNavigationTransitionInfo navigationTransitionInfo)
 {
     if (employee != null)
     {
         ContentFrame.Navigate(typeof(SettingsPage), new object[] { employee }, navigationTransitionInfo);
         //NavigationHeader.Text = $"Einstellungen von {employee.Alias}";
     }
 }
        /// <summary>
        /// Navigates the current frame to the specified page type with the specified parameter.
        /// </summary>
        /// <param name="sourcePageType">
        /// The page type to navigate to.
        /// </param>
        /// <param name="parameter">
        /// The parameter to pass to the page.
        /// </param>
        /// <param name="transition">
        /// The navigation transition.
        /// </param>
        /// <returns>
        /// Returns a <see cref="bool"/> indicating whether the navigation was successful.
        /// </returns>
        public bool Navigate(Type sourcePageType, object parameter, NavigationTransitionInfo transition = null)
        {
            if (transition == null)
            {
                transition = new SlideNavigationTransitionInfo();
            }

            return(this.Frame != null && this.Frame.Navigate(sourcePageType, parameter, transition));
        }
Exemplo n.º 5
0
        private async void PagesNavigation(string toPage, bool samePage = false)
        {
            var dir  = new SlideNavigationTransitionInfo();
            var page = typeof(Page);

            switch (toPage)
            {
            case "Home":
                dir.Effect      = SlideNavigationTransitionEffect.FromLeft;
                page            = typeof(Home);
                CurrentTabIndex = 0;
                break;

            case "Coins":
                dir.Effect      = (CurrentTabIndex > 1) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight;
                page            = typeof(Coins);
                CurrentTabIndex = 1;
                break;

            case "News":
                dir.Effect      = (CurrentTabIndex > 2) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight;
                page            = typeof(News);
                CurrentTabIndex = 2;
                break;

            case "Portfolio":
                dir.Effect      = (CurrentTabIndex > 3) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight;
                page            = typeof(Portfolio);
                CurrentTabIndex = 3;
                break;
            }

            ///if it's the same page, override the default animation for one from the Bottom
            if (samePage)
            {
                dir.Effect = SlideNavigationTransitionEffect.FromBottom;
            }

            /// Redirect to a coin's page from a Live Tile (and clear Redirect as it's a one-time)
            if (toPage == "Home" && Redirect != "")
            {
                ContentFrame.Navigate(typeof(CoinDetails), Redirect, dir);
                Redirect = "";
            }
            else if (toPage == "Settings")
            {
                var settings = new SettingsDialog();
                await settings.ShowAsync();
            }
            else
            {
                ContentFrame.Navigate(page, null, dir);
            }
        }
Exemplo n.º 6
0
        private void InitializePageAnimation()
        {
            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            var info = new SlideNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            Transitions = collection;
        }
Exemplo n.º 7
0
        private void NavigateToPage(object naviItem, bool isSettingsPage, NavigationViewPaneDisplayMode paneDisplayMode)
        {
            if (!(naviItem is NavigationViewItem item))
            {
                return;
            }

            var targetInfo = GetTargetNaviInfo(item.Name, isSettingsPage);

            if (targetInfo.Page == null || targetInfo.Page == NaviContent.Content?.GetType())
            {
                return;
            }

            // Get current selected index of navimenu
            var index = NaviMenu.MenuItems.IndexOf(item);

            if (isSettingsPage)
            {
                item.Content = App.CultureResource.GetString("NaviMenu_Item_Settings/Content");
                index        = NaviMenu.MenuItems.Count;
            }

            // Set up page transition effect base on pane display mode
            NavigationTransitionInfo transition;

            if (paneDisplayMode == NavigationViewPaneDisplayMode.Top)
            {
                transition = new SlideNavigationTransitionInfo
                {
                    Effect = lastSelectedItemIndex <= index ? SlideNavigationTransitionEffect.FromRight : SlideNavigationTransitionEffect.FromLeft
                };
            }
            else
            {
                transition = new DrillInNavigationTransitionInfo();
            }

            // Update navi history and last selected index of navimenu
            if (lastSelectedItemIndex != -1)
            {
                navimenuNaviHistory.Push(lastSelectedItemIndex);
            }
            lastSelectedItemIndex = index;

            // Navigate to page
            NaviContent.Navigate(targetInfo.Page, targetInfo.Parameter, transition);

            // Set current selected item for navimenu
            NaviMenu.SelectedItem = naviItem;
        }
Exemplo n.º 8
0
        private void PagesNavigation(string toPage, bool samePage = false)
        {
            var dir  = new SlideNavigationTransitionInfo();
            var page = typeof(Page);

            switch (toPage)
            {
            case "Home":
                dir.Effect      = SlideNavigationTransitionEffect.FromLeft;
                page            = typeof(Home);
                CurrentTabIndex = 0;
                break;

            case "Top 100":
                dir.Effect      = (CurrentTabIndex > 1) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight;
                page            = typeof(Top100);
                CurrentTabIndex = 1;
                break;

            case "News":
                dir.Effect      = (CurrentTabIndex > 2) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight;
                page            = typeof(News);
                CurrentTabIndex = 2;
                break;

            case "Portfolio":
                dir.Effect      = (CurrentTabIndex > 3) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight;
                page            = typeof(Portfolio);
                CurrentTabIndex = 3;
                break;

            case "Settings":
                dir.Effect      = SlideNavigationTransitionEffect.FromRight;
                page            = typeof(Settings);
                CurrentTabIndex = 4;
                break;
            }

            // if it's the same page, override the default animation for one from the Bottom
            if (samePage)
            {
                dir.Effect = SlideNavigationTransitionEffect.FromBottom;
            }

            ContentFrame.Navigate(page, null, dir);
        }
Exemplo n.º 9
0
        private async void Navigator_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
        {
            FrameNavigationOptions navOptions = new FrameNavigationOptions
            {
                TransitionInfoOverride = args.RecommendedNavigationTransitionInfo
            };

            var navigationTransitionInfo = new SlideNavigationTransitionInfo
            {
                Effect = SlideNavigationTransitionEffect.FromLeft
            };

            if (args.IsSettingsSelected)
            {
                NavigateToSettingsPage(LocalClient.Employee, navigationTransitionInfo);
                return;
            }

            if (args.SelectedItem is NavigationViewItem navigationViewItem && navigationViewItem.Tag is string tag)
            {
                if (_pages.TryGetValue(tag, out Type type))
                {
                    /*if (tag == "ProjectViewer" && CurrentTabView != null)
                     * {
                     *  parameter = CurrentTabView;
                     * }
                     *
                     * if (ContentFrame.Navigate(type, parameter, navigationTransitionInfo))
                     * {
                     *  CurrentPageKey = tag;
                     *
                     *  if (tag == "ProjectViewer" && CurrentTabView == null)
                     *  {
                     *      CurrentTabView = (ContentFrame.Content as ProjectViewerPage).TabViewCollection;
                     *  }
                     * }*/

                    if (tag == "ProjectViewer")
                    {
                        ContentFrame.Navigate(type, LocalClient.Employee, navigationTransitionInfo);
                    }
                    else if (tag == "Administration")
                    {
                        ContentFrame.Navigate(type, null, navigationTransitionInfo);
                    }
                    else if (tag == "Configuration")
                    {
                        ContentFrame.Navigate(type, null, navigationTransitionInfo);
                    }
                    else if (tag == "ElementView")
                    {
                        if (LocalClient.Employee == null)
                        {
                            var infoDialog = new InfoDialog("Du musst Dich anmelden, um Einsicht in den aktuellen Fertigungsstatus zu bekommen!");
                            await infoDialog.ShowAsync();

                            return;
                        }
                        ContentFrame.Navigate(type, LocalClient.Employee, navigationTransitionInfo);
                    }
                }
            }

            //ContentFrame.Navigate(typeof(AdministrationPage), null, navigationTransitionInfo);
        }
Exemplo n.º 10
0
        // 以下演示如何在导航目标页设置 NavigationTransitionInfo 动画效果
        private void btnGotoSlideNavigationTransitionInfo_Click2(object sender, RoutedEventArgs e)
        {
            SlideNavigationTransitionInfo slideTransition = new SlideNavigationTransitionInfo();

            this.Frame.Navigate(typeof(MyFrame), slideTransition);
        }
Exemplo n.º 11
0
        private void FilesAppBarButton_OnClickAppBarButton_Click(object sender, RoutedEventArgs e)
        {
            NavigationTransitionInfo transitionInfo = new SlideNavigationTransitionInfo();

            Frame.Navigate(typeof(AllSourcesPage), false, transitionInfo);
        }
Exemplo n.º 12
0
        private void SwitchServerAppBarButton_Click(object sender, RoutedEventArgs e)
        {
            NavigationTransitionInfo transitionInfo = new SlideNavigationTransitionInfo();

            Frame.Navigate(typeof(MainPage), false, transitionInfo);
        }
Exemplo n.º 13
0
        private void AdvancedMenuFlyout_ItemsPicked(ListPickerFlyout sender, ItemsPickedEventArgs args)
        {
            string pickedCommand = (string)AdvancedMenuFlyout.SelectedItem;

            if (pickedCommand == audioLibUpdate)
                AudioLibrary.Scan();
            else if (pickedCommand == videoLibUpdate)
                VideoLibrary.Scan();
            else if (pickedCommand == audioLibClean)
                AudioLibrary.Clean();
            else if (pickedCommand == videoLibClean)
                VideoLibrary.Clean();
            else if (pickedCommand == showSubtitleSerach)
                GUI.ShowSubtitleSearch();
            else if (pickedCommand == showVideoInfo)
                Input.ExecuteAction("codecinfo");
            else if (pickedCommand == shutDown)
            {
                Applikation.Quit();
                NavigationTransitionInfo transitionInfo = new SlideNavigationTransitionInfo();
                Frame.Navigate(typeof(MainPage), false, transitionInfo);
            }
        }
Exemplo n.º 14
0
 private void FilesAppBarButton_OnClickAppBarButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationTransitionInfo transitionInfo = new SlideNavigationTransitionInfo();
     Frame.Navigate(typeof(AllSourcesPage), false, transitionInfo);
 }
Exemplo n.º 15
0
 private void SwitchServerAppBarButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationTransitionInfo transitionInfo = new SlideNavigationTransitionInfo();
     Frame.Navigate(typeof(MainPage), false, transitionInfo);
 }
Exemplo n.º 16
0
        private void NavTabClicked(object sender, RoutedEventArgs e)
        {
            // Don't perform navigation when blocked (when setting the boxes to checked).
            if (_isNavigationBlocked)
            {
                return;
            }

            // Navigation effects (side navigation only supported on v7+)
            var navTransitionRight = new SlideNavigationTransitionInfo();

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
            {
                navTransitionRight.Effect = SlideNavigationTransitionEffect.FromRight;
            }

            var navTransitionLeft = new SlideNavigationTransitionInfo();

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
            {
                navTransitionLeft.Effect = SlideNavigationTransitionEffect.FromLeft;
            }

            // Switch on the selected item name
            var name = ((RadioButton)sender).Name;

            switch (name)
            {
            case nameof(PlayingTab):
                if (RootFrame.CurrentSourcePageType != typeof(XboxPlayingView))
                {
                    RootFrame.Navigate(typeof(XboxPlayingView), null, _navigationIndex > 1 ? navTransitionLeft : navTransitionRight);
                }
                break;

            case nameof(ExploreTab):
                if (RootFrame.CurrentSourcePageType != typeof(XboxExploreView))
                {
                    RootFrame.Navigate(typeof(XboxExploreView), null, _navigationIndex > 2 ? navTransitionLeft : navTransitionRight);
                }
                break;

            case nameof(MusicTab):
                if (RootFrame.CurrentSourcePageType != typeof(XboxMusicView))
                {
                    RootFrame.Navigate(typeof(XboxMusicView), null, _navigationIndex > 3 ? navTransitionLeft : navTransitionRight);
                }
                break;

            case nameof(SearchTab):
                if (RootFrame.CurrentSourcePageType != typeof(XboxSearchView))
                {
                    RootFrame.Navigate(typeof(XboxSearchView), null, _navigationIndex > 4 ? navTransitionLeft : navTransitionRight);
                }
                break;

            case nameof(SettingsTab):
                if (RootFrame.CurrentSourcePageType != typeof(XboxSettingsView))
                {
                    RootFrame.Navigate(typeof(XboxSettingsView), null, _navigationIndex > 5 ? navTransitionLeft : navTransitionRight);
                }
                break;
            }
        }