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(); } }
public TabViewContainer() { InitializeComponent(); ThisPage = this; Loaded += TabViewContainer_Loaded; TabCollection.CollectionChanged += TabCollection_CollectionChanged; Application.Current.Suspending += Current_Suspending; CoreWindow.GetForCurrentThread().PointerPressed += TabViewContainer_PointerPressed; CoreWindow.GetForCurrentThread().KeyDown += TabViewContainer_KeyDown; CommonAccessCollection.LibraryNotFound += CommonAccessCollection_LibraryNotFound; QueueFileOperationController.ListItemSource.CollectionChanged += ListItemSource_CollectionChanged; if (ApplicationData.Current.LocalSettings.Values["ShouldPinTaskList"] is bool ShouldPin) { if (ShouldPin) { TaskListPanel.DisplayMode = SplitViewDisplayMode.Inline; TaskListPanel.IsPaneOpen = true; PinTaskListPanel.Content = new Viewbox { Child = new FontIcon { Glyph = "\uE77A" } }; } else { TaskListPanel.DisplayMode = SplitViewDisplayMode.Overlay; TaskListPanel.IsPaneOpen = false; PinTaskListPanel.Content = new Viewbox { Child = new FontIcon { Glyph = "\uE840" } }; } } else { TaskListPanel.DisplayMode = SplitViewDisplayMode.Overlay; ApplicationData.Current.LocalSettings.Values["ShouldPinTaskList"] = false; PinTaskListPanel.Content = new Viewbox { Child = new FontIcon { Glyph = "\uE840" } }; } }
public TabViewContainer() { InitializeComponent(); ThisPage = this; Loaded += TabViewContainer_Loaded; Application.Current.Suspending += Current_Suspending; CoreWindow.GetForCurrentThread().PointerPressed += TabViewContainer_PointerPressed; CoreWindow.GetForCurrentThread().KeyDown += TabViewContainer_KeyDown; CommonAccessCollection.LibraryNotFound += CommonAccessCollection_LibraryNotFound; }
public TabViewContainer() { InitializeComponent(); ThisPage = this; Loaded += TabViewContainer_Loaded; PortalDeviceWatcher.Added += PortalDeviceWatcher_Added; PortalDeviceWatcher.Removed += PortalDeviceWatcher_Removed; Application.Current.Resuming += Current_Resuming; Application.Current.Suspending += Current_Suspending; CoreWindow.GetForCurrentThread().PointerPressed += TabViewContainer_PointerPressed; CoreWindow.GetForCurrentThread().KeyDown += TabViewContainer_KeyDown; }
protected override void OnActivated(IActivatedEventArgs args) { CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; var viewTitleBar = ApplicationView.GetForCurrentView().TitleBar; viewTitleBar.ButtonBackgroundColor = Colors.Transparent; viewTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; viewTitleBar.ButtonForegroundColor = (Color)Resources["SystemBaseHighColor"]; if (Window.Current.Content is Frame mainPageFrame) { var cmdArgs = args as CommandLineActivatedEventArgs; var mainPage = mainPageFrame.Content as MainPage; Window.Current.Activate(); mainPage.NavView.IsBackEnabled = (TabViewContainer.CurrentTabNavigation?.CanGoBack).GetValueOrDefault(); mainPage.Nav.Navigate(typeof(TabViewContainer), null, new SlideNavigationTransitionInfo() { Effect = SlideNavigationTransitionEffect.FromLeft }); TabViewContainer tabViewContainer = mainPage.Nav.Content as TabViewContainer; _ = tabViewContainer.CreateNewTabAndOpenTargetFolder(cmdArgs.Operation.Arguments.Substring(16)); } else //Window.Current.Content is Frame(MainPage) { if (args is CommandLineActivatedEventArgs CmdArgs) { if (string.IsNullOrWhiteSpace(CmdArgs.Operation.Arguments)) { ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen); Window.Current.Content = extendedSplash; } else { //此处采用了简略解析方法,只能解析“RX-Explorer.exe {PathToOpen}”的命令行格式,其他的(包括有路径前缀的)解析不了。如果有需要,后面再修改。 if (CmdArgs.Operation.Arguments.StartsWith("RX-Explorer.exe")) { ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, false, $"PathActivate||{CmdArgs.Operation.Arguments.Split(" ").LastOrDefault()}"); Window.Current.Content = extendedSplash; } else { ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen); Window.Current.Content = extendedSplash; } } } else if (args is ProtocolActivatedEventArgs ProtocalArgs) { if (!string.IsNullOrWhiteSpace(ProtocalArgs.Uri.LocalPath)) { ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, false, $"PathActivate||{ProtocalArgs.Uri.LocalPath}"); Window.Current.Content = extendedSplash; } else { ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen); Window.Current.Content = extendedSplash; } } else { ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen); Window.Current.Content = extendedSplash; } Window.Current.Activate(); } }
private void MainPage_BackRequested(object sender, BackRequestedEventArgs e) { TabViewContainer.GoBack(); e.Handled = true; }