private async void Button_PointerPressed(object sender, PointerRoutedEventArgs e) { if (e.GetCurrentPoint(null).Properties.IsMiddleButtonPressed) // check middle click { string navigationPath = (sender as Button).Tag.ToString(); await NavigationHelpers.OpenPathInNewTab(navigationPath); } }
public static async void OpenThemesFolder() { Frame rootFrame = Window.Current.Content as Frame; // Go back to main page if (rootFrame.CanGoBack) { rootFrame.GoBack(); } await NavigationHelpers.OpenPathInNewTab(App.ExternalResourcesHelper.ThemeFolder.Path); }
public override void GetBaseProperties() { if (Item != null) { ViewModel.ItemName = Item.ItemName; ViewModel.OriginalItemName = Item.ItemName; ViewModel.ItemType = Item.ItemType; ViewModel.ItemPath = (Item as RecycleBinItem)?.ItemOriginalFolder ?? (Path.IsPathRooted(Item.ItemPath) ? Path.GetDirectoryName(Item.ItemPath) : Item.ItemPath); ViewModel.ItemModifiedTimestamp = Item.ItemDateModified; ViewModel.ItemCreatedTimestamp = Item.ItemDateCreated; ViewModel.LoadFolderGlyph = Item.LoadFolderGlyph; ViewModel.IconData = Item.CustomIconData; ViewModel.LoadUnknownTypeGlyph = Item.LoadUnknownTypeGlyph; ViewModel.LoadCustomIcon = Item.LoadCustomIcon; ViewModel.CustomIconSource = Item.CustomIconSource; ViewModel.LoadFileIcon = Item.LoadFileIcon; if (Item.IsShortcutItem) { var shortcutItem = (ShortcutItem)Item; var isApplication = !string.IsNullOrWhiteSpace(shortcutItem.TargetPath) && (shortcutItem.TargetPath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) || shortcutItem.TargetPath.EndsWith(".msi", StringComparison.OrdinalIgnoreCase) || shortcutItem.TargetPath.EndsWith(".bat", StringComparison.OrdinalIgnoreCase)); ViewModel.ShortcutItemType = isApplication ? "PropertiesShortcutTypeApplication".GetLocalized() : Item.IsLinkItem ? "PropertiesShortcutTypeLink".GetLocalized() : "PropertiesShortcutTypeFile".GetLocalized(); ViewModel.ShortcutItemPath = shortcutItem.TargetPath; ViewModel.ShortcutItemWorkingDir = shortcutItem.WorkingDirectory; ViewModel.ShortcutItemWorkingDirVisibility = Item.IsLinkItem ? Visibility.Collapsed : Visibility.Visible; ViewModel.ShortcutItemArguments = shortcutItem.Arguments; ViewModel.ShortcutItemArgumentsVisibility = Item.IsLinkItem ? Visibility.Collapsed : Visibility.Visible; ViewModel.IsSelectedItemShortcut = Item.FileExtension.Equals(".lnk", StringComparison.OrdinalIgnoreCase); ViewModel.ShortcutItemOpenLinkCommand = new RelayCommand(async() => { if (Item.IsLinkItem) { var tmpItem = (ShortcutItem)Item; await Win32Helpers.InvokeWin32ComponentAsync(ViewModel.ShortcutItemPath, AppInstance, ViewModel.ShortcutItemArguments, tmpItem.RunAsAdmin, ViewModel.ShortcutItemWorkingDir); } else { await CoreApplication.MainView.DispatcherQueue.EnqueueAsync( () => NavigationHelpers.OpenPathInNewTab(Path.GetDirectoryName(ViewModel.ShortcutItemPath))); } }, () => { return(!string.IsNullOrWhiteSpace(ViewModel.ShortcutItemPath)); }); } } }
private void AllView_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { tapDebounceTimer.Stop(); if (AppSettings.OpenFoldersNewTab) { NavigationHelpers.OpenPathInNewTab(((e.OriginalSource as FrameworkElement)?.DataContext as ListedItem).ItemPath); } else { NavigationHelpers.OpenSelectedItems(ParentShellPageInstance, false); } }
public virtual void ItemPointerPressed(PointerRoutedEventArgs e) { if (e.GetCurrentPoint(null).Properties.IsMiddleButtonPressed) { if ((e.OriginalSource as FrameworkElement)?.DataContext is ListedItem Item && Item.PrimaryItemAttribute == StorageItemTypes.Folder) { if (Item.IsShortcutItem) { NavigationHelpers.OpenPathInNewTab(((e.OriginalSource as FrameworkElement)?.DataContext as ShortcutItem)?.TargetPath ?? Item.ItemPath); } else { NavigationHelpers.OpenPathInNewTab(Item.ItemPath); } } } }
public virtual async void ItemPointerPressed(PointerRoutedEventArgs e) { if (e.GetCurrentPoint(null).Properties.IsMiddleButtonPressed) { if ((e.OriginalSource as FrameworkElement)?.DataContext is ListedItem Item && Item.PrimaryItemAttribute == StorageItemTypes.Folder) { // If a folder item was clicked, disable middle mouse click to scroll to cancel the mouse scrolling state and re-enable it SlimContentPage.IsMiddleClickToScrollEnabled = false; SlimContentPage.IsMiddleClickToScrollEnabled = true; if (Item.IsShortcutItem) { await NavigationHelpers.OpenPathInNewTab(((e.OriginalSource as FrameworkElement)?.DataContext as ShortcutItem)?.TargetPath ?? Item.ItemPath); } else { await NavigationHelpers.OpenPathInNewTab(Item.ItemPath); } } } }
public override void GetBaseProperties() { if (Item != null) { ViewModel.ItemName = Item.ItemName; ViewModel.OriginalItemName = Item.ItemName; ViewModel.ItemType = Item.ItemType; ViewModel.ItemPath = (Item as RecycleBinItem)?.ItemOriginalFolder ?? (Path.IsPathRooted(Item.ItemPath) ? Path.GetDirectoryName(Item.ItemPath) : Item.ItemPath); ViewModel.ItemModifiedTimestamp = Item.ItemDateModified; ViewModel.ItemCreatedTimestamp = Item.ItemDateCreated; ViewModel.LoadFolderGlyph = Item.LoadFolderGlyph; ViewModel.IconData = Item.CustomIconData; ViewModel.LoadUnknownTypeGlyph = Item.LoadUnknownTypeGlyph; ViewModel.LoadCustomIcon = Item.LoadCustomIcon; ViewModel.CustomIconSource = Item.CustomIconSource; ViewModel.LoadFileIcon = Item.LoadFileIcon; ViewModel.ContainsFilesOrFolders = Item.ContainsFilesOrFolders; if (Item.IsShortcutItem) { var shortcutItem = (ShortcutItem)Item; ViewModel.ShortcutItemType = "PropertiesShortcutTypeFolder".GetLocalized(); ViewModel.ShortcutItemPath = shortcutItem.TargetPath; ViewModel.ShortcutItemWorkingDir = shortcutItem.WorkingDirectory; ViewModel.ShortcutItemWorkingDirVisibility = Visibility.Collapsed; ViewModel.ShortcutItemArguments = shortcutItem.Arguments; ViewModel.ShortcutItemArgumentsVisibility = Visibility.Collapsed; ViewModel.ShortcutItemOpenLinkCommand = new RelayCommand(async() => { await CoreApplication.MainView.DispatcherQueue.EnqueueAsync( () => NavigationHelpers.OpenPathInNewTab(Path.GetDirectoryName(ViewModel.ShortcutItemPath))); }, () => { return(!string.IsNullOrWhiteSpace(ViewModel.ShortcutItemPath)); }); } } }
public static async void OpenSkinsFolder() => await NavigationHelpers.OpenPathInNewTab(App.ExternalResourcesHelper.SkinFolder.Path);
public static async void OpenThemesFolder() { await CoreApplication.MainView.Dispatcher.YieldAsync(); await NavigationHelpers.OpenPathInNewTab(App.ExternalResourcesHelper.ImportedThemesFolder.Path); }
private void OpenInNewTab_Click(object sender, RoutedEventArgs e) { var item = ((MenuFlyoutItem)sender).DataContext as LibraryCardItem; NavigationHelpers.OpenPathInNewTab(item.Path); }