Ejemplo n.º 1
0
        private async void TabStrip_TabStripDrop(object sender, DragEventArgs e)
        {
            HorizontalTabView.CanReorderTabs = true;
            if (!(sender is TabView tabStrip))
            {
                return;
            }

            if (!e.DataView.Properties.TryGetValue(TabPathIdentifier, out object tabViewItemPathObj) || !(tabViewItemPathObj is string tabViewItemPath))
            {
                return;
            }

            var index = -1;

            for (int i = 0; i < tabStrip.TabItems.Count; i++)
            {
                var item = tabStrip.ContainerFromIndex(i) as TabViewItem;

                if (e.GetPosition(item).Y - item.ActualHeight < 0)
                {
                    index = i;
                    break;
                }
            }

            ApplicationData.Current.LocalSettings.Values[TabDropHandledIdentifier] = true;
            await MainPage.AddNewTabByPathAsync(typeof(ModernShellPage), tabViewItemPath, index);
        }
 public virtual async void OpenDirectoryInNewTab(RoutedEventArgs e)
 {
     foreach (ListedItem listedItem in SlimContentPage.SelectedItems)
     {
         await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Low, async() =>
         {
             await MainPage.AddNewTabByPathAsync(typeof(PaneHolderPage), (listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath);
         });
     }
 }
Ejemplo n.º 3
0
 public static async void OpenPathInNewTab(string path)
 {
     await MainPage.AddNewTabByPathAsync(typeof(PaneHolderPage), path);
 }