コード例 #1
0
ファイル: ProHome.xaml.cs プロジェクト: xJavii8/files-uwp
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.OccupiedInstance == null && ItemViewModel.GetCurrentSelectedTabInstance <ProHome>().Equals(this))
            {
                App.OccupiedInstance = this;
            }

            if (NavParams == "Start" || NavParams == "New tab")
            {
                ItemDisplayFrame.Navigate(typeof(YourHome), NavParams, new SuppressNavigationTransitionInfo());
                LocationsList.SelectedItem = App.sideBarItems[0];
            }
            else if (NavParams == "Desktop")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.DesktopPath, new SuppressNavigationTransitionInfo());
                LocationsList.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.DesktopPath, StringComparison.OrdinalIgnoreCase));
            }
            else if (NavParams == "Downloads")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.DownloadsPath, new SuppressNavigationTransitionInfo());
                LocationsList.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.DownloadsPath, StringComparison.OrdinalIgnoreCase));
            }
            else if (NavParams == "Documents")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.DocumentsPath, new SuppressNavigationTransitionInfo());
                LocationsList.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.DocumentsPath, StringComparison.OrdinalIgnoreCase));
            }
            else if (NavParams == "Pictures" || NavParams == App.PicturesPath)
            {
                ItemDisplayFrame.Navigate(typeof(PhotoAlbum), App.PicturesPath, new SuppressNavigationTransitionInfo());
                LocationsList.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.PicturesPath, StringComparison.OrdinalIgnoreCase));
            }
            else if (NavParams == "Music")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.MusicPath, new SuppressNavigationTransitionInfo());
                LocationsList.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.MusicPath, StringComparison.OrdinalIgnoreCase));
            }
            else if (NavParams == "Videos")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.VideosPath, new SuppressNavigationTransitionInfo());
                LocationsList.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.VideosPath, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), NavParams, new SuppressNavigationTransitionInfo());
                if (NavParams.Contains("C:", StringComparison.OrdinalIgnoreCase))
                {
                    DrivesList.SelectedItem = App.foundDrives.First(x => x.tag.ToString().Equals("C:\\", StringComparison.OrdinalIgnoreCase));
                }
                else
                {
                    DrivesList.SelectedItem = null;
                }
            }

            this.Loaded -= Page_Loaded;
        }
コード例 #2
0
ファイル: ProHome.xaml.cs プロジェクト: xJavii8/files-uwp
        private void DrivesList_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args)
        {
            HomeItems.isEnabled  = false;
            ShareItems.isEnabled = false;
            if (LocationsList.SelectedItem != null)
            {
                LocationsList.SelectedItem = null;
                LayoutItems.isEnabled      = false;
            }

            if (LinuxList != null)
            {
                if (LinuxList.SelectedItem != null)
                {
                    LinuxList.SelectedItem = null;
                    LayoutItems.isEnabled  = false;
                }
            }


            var clickedItem = args.InvokedItemContainer;

            if (clickedItem.Tag.ToString() == "LocalDisk")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), @"C:\", new SuppressNavigationTransitionInfo());
                PathText.Text         = @"Local Disk (C:\)";
                LayoutItems.isEnabled = true;
            }
            else if (clickedItem.Tag.ToString() == "OneDrive")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.OneDrivePath, new SuppressNavigationTransitionInfo());
                PathText.Text         = "OneDrive";
                LayoutItems.isEnabled = true;
            }
            else
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), clickedItem.Tag.ToString(), new SuppressNavigationTransitionInfo());
                PathText.Text         = clickedItem.Tag.ToString();
                LayoutItems.isEnabled = true;
            }
        }
コード例 #3
0
ファイル: ProHome.xaml.cs プロジェクト: xJavii8/files-uwp
        private void LinuxList_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args)
        {
            HomeItems.isEnabled  = false;
            ShareItems.isEnabled = false;
            if (LocationsList.SelectedItem != null)
            {
                LocationsList.SelectedItem = null;
                LayoutItems.isEnabled      = false;
            }

            if (DrivesList.SelectedItem != null)
            {
                DrivesList.SelectedItem = null;
                LayoutItems.isEnabled   = false;
            }

            var clickedItem = args.InvokedItemContainer;

            ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), clickedItem.Tag.ToString(), new SuppressNavigationTransitionInfo());
            PathText.Text         = clickedItem.Tag.ToString();
            LayoutItems.isEnabled = true;
        }
コード例 #4
0
ファイル: ProHome.xaml.cs プロジェクト: xJavii8/files-uwp
        private void LocationsList_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args)
        {
            var clickedItem          = args.InvokedItem.ToString();
            var clickedItemContainer = args.InvokedItemContainer;

            HomeItems.isEnabled  = false;
            ShareItems.isEnabled = false;
            if (LinuxList != null)
            {
                if (LinuxList.SelectedItem != null)
                {
                    LinuxList.SelectedItem = null;
                    LayoutItems.isEnabled  = false;
                }
            }


            if (DrivesList.SelectedItem != null)
            {
                DrivesList.SelectedItem = null;
                LayoutItems.isEnabled   = false;
            }

            if (clickedItem == "Home")
            {
                ItemDisplayFrame.Navigate(typeof(YourHome), "New tab", new SuppressNavigationTransitionInfo());
                PathText.Text        = "New tab";
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = false;
            }
            else if (clickedItem == "Desktop")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.DesktopPath, new SuppressNavigationTransitionInfo());
                PathText.Text        = "Desktop";
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = true;
            }
            else if (clickedItem == "Downloads")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.DownloadsPath, new SuppressNavigationTransitionInfo());
                PathText.Text        = "Downloads";
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = true;
            }
            else if (clickedItem == "Documents")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.DocumentsPath, new SuppressNavigationTransitionInfo());
                PathText.Text        = "Documents";
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = true;
            }
            else if (clickedItem == "Pictures")
            {
                ItemDisplayFrame.Navigate(typeof(PhotoAlbum), App.PicturesPath, new SuppressNavigationTransitionInfo());
                PathText.Text        = "Pictures";
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = true;
            }
            else if (clickedItem == "Music")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.MusicPath, new SuppressNavigationTransitionInfo());
                PathText.Text        = "Music";
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = true;
            }
            else if (clickedItem == "Videos")
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.VideosPath, new SuppressNavigationTransitionInfo());
                PathText.Text        = "Videos";
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = true;
            }
            else
            {
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), clickedItemContainer.Tag.ToString(), new SuppressNavigationTransitionInfo());
                PathText.Text        = clickedItem;
                HomeItems.isEnabled  = false;
                ShareItems.isEnabled = false;

                LayoutItems.isEnabled = true;
            }
        }
コード例 #5
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            viewModel            = new ItemViewModel();
            interactionOperation = new Interaction();

            switch (NavParams)
            {
            case "Start":
                ItemDisplayFrame.Navigate(typeof(YourHome), NavParams, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems[0];
                break;

            case "New tab":
                ItemDisplayFrame.Navigate(typeof(YourHome), NavParams, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems[0];
                break;

            case "Desktop":
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.DesktopPath, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.AppSettings.DesktopPath, StringComparison.OrdinalIgnoreCase));
                break;

            case "Downloads":
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.DownloadsPath, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.AppSettings.DownloadsPath, StringComparison.OrdinalIgnoreCase));
                break;

            case "Documents":
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.DocumentsPath, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.AppSettings.DocumentsPath, StringComparison.OrdinalIgnoreCase));
                break;

            case "Pictures":
                ItemDisplayFrame.Navigate(typeof(PhotoAlbum), App.AppSettings.PicturesPath, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.AppSettings.PicturesPath, StringComparison.OrdinalIgnoreCase));
                break;

            case "Music":
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.MusicPath, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.AppSettings.MusicPath, StringComparison.OrdinalIgnoreCase));
                break;

            case "Videos":
                ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.VideosPath, new SuppressNavigationTransitionInfo());
                SidebarControl.SidebarNavView.SelectedItem = App.sideBarItems.First(x => x.Path.Equals(App.AppSettings.VideosPath, StringComparison.OrdinalIgnoreCase));
                break;

            default:
                if (NavParams[0] >= 'A' && NavParams[0] <= 'Z' && NavParams[1] == ':')
                {
                    ItemDisplayFrame.Navigate(typeof(GenericFileBrowser), NavParams, new SuppressNavigationTransitionInfo());
                    SidebarControl.SidebarNavView.SelectedItem = SettingsViewModel.foundDrives.First(x => x.tag.ToString().Equals($"{NavParams[0]}:\\", StringComparison.OrdinalIgnoreCase));
                }
                else
                {
                    SidebarControl.SidebarNavView.SelectedItem = null;
                }
                break;
            }

            this.Loaded -= Page_Loaded;
        }