Exemple #1
0
        public async void NavView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
        {
            if ((SettingControl?.IsOpened).GetValueOrDefault())
            {
                if (Nav.CurrentSourcePageType == typeof(TabViewContainer))
                {
                    NavView.IsBackEnabled = (TabViewContainer.CurrentTabNavigation?.CanGoBack).GetValueOrDefault();
                }
                else
                {
                    NavView.IsBackEnabled = false;
                }

                if (NavView.MenuItems.Select((Item) => Item as NavigationViewItem).FirstOrDefault((Item) => Item.Content.ToString() == PageDictionary[Nav.CurrentSourcePageType]) is NavigationViewItem Item)
                {
                    Item.IsSelected = true;
                }

                await SettingControl.Hide().ConfigureAwait(false);
            }
            else
            {
                TabViewContainer.GoBack();
            }
        }
Exemple #2
0
        private async void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
        {
            try
            {
                if (args.IsSettingsInvoked)
                {
                    _ = FindName(nameof(SettingControl));

                    await SettingControl.Show().ConfigureAwait(true);

                    NavView.IsBackEnabled = true;
                }
                else
                {
                    if ((SettingControl?.IsOpened).GetValueOrDefault())
                    {
                        await SettingControl.Hide().ConfigureAwait(true);
                    }

                    if (args.InvokedItem.ToString() == Globalization.GetString("MainPage_PageDictionary_ThisPC_Label"))
                    {
                        NavView.IsBackEnabled = (TabViewContainer.CurrentTabNavigation?.CanGoBack).GetValueOrDefault();
                        Nav.Navigate(typeof(TabViewContainer), null, new SlideNavigationTransitionInfo()
                        {
                            Effect = SlideNavigationTransitionEffect.FromLeft
                        });
                    }
                    else if (args.InvokedItem.ToString() == Globalization.GetString("MainPage_PageDictionary_SecureArea_Label"))
                    {
                        NavView.IsBackEnabled = false;
                        Nav.Navigate(typeof(SecureArea), null, new SlideNavigationTransitionInfo()
                        {
                            Effect = SlideNavigationTransitionEffect.FromRight
                        });
                    }
                    else if (args.InvokedItem.ToString() == Globalization.GetString("MainPage_PageDictionary_RecycleBin_Label"))
                    {
                        NavView.IsBackEnabled = false;
                        Nav.Navigate(typeof(RecycleBin), null, new SlideNavigationTransitionInfo()
                        {
                            Effect = Nav.CurrentSourcePageType == typeof(SecureArea) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }