示例#1
0
 public static void CloseOtherTabs(TabItem clickedTab, IMultitaskingControl multitaskingControl)
 {
     if (multitaskingControl is not null)
     {
         var tabs = MainPageViewModel.AppInstances;
         tabs.Where((t) => t != clickedTab).ToList().ForEach(tab => multitaskingControl.CloseTab(tab));
     }
 }
示例#2
0
        public static void CloseTabsToTheRight(TabItem clickedTab, IMultitaskingControl multitaskingControl)
        {
            if (multitaskingControl is not null)
            {
                var tabs         = MainPageViewModel.AppInstances;
                var currentIndex = tabs.IndexOf(clickedTab);

                tabs.Skip(currentIndex + 1).ToList().ForEach(tab => multitaskingControl.CloseTab(tab));
            }
        }
示例#3
0
        public static void CloseTabsToTheRight(TabItem clickedTab, IMultitaskingControl multitaskingControl)
        {
            int            index       = MainPageViewModel.AppInstances.IndexOf(clickedTab);
            List <TabItem> tabsToClose = new List <TabItem>();

            for (int i = index + 1; i < MainPageViewModel.AppInstances.Count; i++)
            {
                tabsToClose.Add(MainPageViewModel.AppInstances[i]);
            }

            foreach (var item in tabsToClose)
            {
                multitaskingControl?.CloseTab(item);
            }
        }
示例#4
0
        public static async Task MoveTabToNewWindow(TabItem tab, IMultitaskingControl multitaskingControl)
        {
            int index = MainPageViewModel.AppInstances.IndexOf(tab);
            TabItemArguments tabItemArguments = MainPageViewModel.AppInstances[index].TabItemArguments;

            multitaskingControl?.CloseTab(MainPageViewModel.AppInstances[index]);

            if (tabItemArguments != null)
            {
                await NavigationHelpers.OpenTabInNewWindowAsync(tabItemArguments.Serialize());
            }
            else
            {
                await NavigationHelpers.OpenPathInNewWindowAsync("Home".GetLocalized());
            }
        }