Example #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
        {
            base.OnNavigatedTo(eventArgs);
            // Add item jumping handler
            AppSettings.LayoutModeChangeRequested       += AppSettings_LayoutModeChangeRequested;
            Window.Current.CoreWindow.CharacterReceived += Page_CharacterReceived;
            var parameters = (NavigationArguments)eventArgs.Parameter;

            isSearchResultPage      = parameters.IsSearchResultPage;
            ParentShellPageInstance = parameters.AssociatedTabInstance;
            IsItemSelected          = false;
            ParentShellPageInstance.FilesystemViewModel.IsFolderEmptyTextDisplayed = false;

            if (!isSearchResultPage)
            {
                ParentShellPageInstance.NavigationToolbar.CanRefresh        = true;
                ParentShellPageInstance.NavigationToolbar.CanCopyPathInPage = true;
                string previousDir = ParentShellPageInstance.FilesystemViewModel.WorkingDirectory;
                await ParentShellPageInstance.FilesystemViewModel.SetWorkingDirectoryAsync(parameters.NavPathParam);

                // pathRoot will be empty on recycle bin path
                var    workingDir = ParentShellPageInstance.FilesystemViewModel.WorkingDirectory;
                string pathRoot   = Path.GetPathRoot(workingDir);
                if (string.IsNullOrEmpty(pathRoot) || workingDir == pathRoot)
                {
                    ParentShellPageInstance.NavigationToolbar.CanNavigateToParent = false;
                }
                else
                {
                    ParentShellPageInstance.NavigationToolbar.CanNavigateToParent = true;
                }
                ParentShellPageInstance.InstanceViewModel.IsPageTypeRecycleBin = workingDir.StartsWith(App.AppSettings.RecycleBinPath);
                ParentShellPageInstance.InstanceViewModel.IsPageTypeMtpDevice  = workingDir.StartsWith("\\\\?\\");

                MainPage.MultitaskingControl?.UpdateSelectedTab(new DirectoryInfo(workingDir).Name, workingDir, false);
                ParentShellPageInstance.FilesystemViewModel.RefreshItems(previousDir);
                ParentShellPageInstance.NavigationToolbar.PathControlDisplayText  = parameters.NavPathParam;
                ParentShellPageInstance.InstanceViewModel.IsPageTypeSearchResults = false;
            }
            else
            {
                ParentShellPageInstance.NavigationToolbar.CanRefresh              = false;
                ParentShellPageInstance.NavigationToolbar.CanCopyPathInPage       = false;
                ParentShellPageInstance.NavigationToolbar.CanNavigateToParent     = false;
                ParentShellPageInstance.InstanceViewModel.IsPageTypeRecycleBin    = false;
                ParentShellPageInstance.InstanceViewModel.IsPageTypeMtpDevice     = false;
                ParentShellPageInstance.InstanceViewModel.IsPageTypeSearchResults = true;

                MainPage.MultitaskingControl?.UpdateSelectedTab(null, null, true);
                ParentShellPageInstance.FilesystemViewModel.AddSearchResultsToCollection(parameters.SearchResults, parameters.SearchPathParam);
            }

            ParentShellPageInstance.InstanceViewModel.IsPageTypeNotHome = true; // show controls that were hidden on the home page
            ParentShellPageInstance.Clipboard_ContentChanged(null, null);

            cachedNewContextMenuEntries = await RegistryHelper.GetNewContextMenuEntries();

            FocusFileList(); // Set focus on layout specific file list control
        }
Example #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
        {
            base.OnNavigatedTo(eventArgs);
            // Add item jumping handler
            AppSettings.LayoutModeChangeRequested       += AppSettings_LayoutModeChangeRequested;
            Window.Current.CoreWindow.CharacterReceived += Page_CharacterReceived;
            var parameters = (NavigationArguments)eventArgs.Parameter;

            ParentShellPageInstance = parameters.AssociatedTabInstance;
            ParentShellPageInstance.NavigationToolbar.CanRefresh = true;
            IsItemSelected = false;
            ParentShellPageInstance.FilesystemViewModel.IsFolderEmptyTextDisplayed = false;
            await ParentShellPageInstance.FilesystemViewModel.SetWorkingDirectory(parameters.NavPathParam);

            // pathRoot will be empty on recycle bin path
            var    workingDir = ParentShellPageInstance.FilesystemViewModel.WorkingDirectory;
            string pathRoot   = Path.GetPathRoot(workingDir);

            if (string.IsNullOrEmpty(pathRoot) || workingDir == pathRoot)
            {
                ParentShellPageInstance.NavigationToolbar.CanNavigateToParent = false;
            }
            else
            {
                ParentShellPageInstance.NavigationToolbar.CanNavigateToParent = true;
            }

            ParentShellPageInstance.InstanceViewModel.IsPageTypeNotHome    = true; // show controls that were hidden on the home page
            ParentShellPageInstance.InstanceViewModel.IsPageTypeRecycleBin = workingDir.StartsWith(App.AppSettings.RecycleBinPath);
            ParentShellPageInstance.InstanceViewModel.IsPageTypeMtpDevice  = workingDir.StartsWith("\\\\?\\");

            MainPage.MultitaskingControl?.UpdateSelectedTab(new DirectoryInfo(workingDir).Name, workingDir);
            ParentShellPageInstance.FilesystemViewModel.RefreshItems();

            ParentShellPageInstance.Clipboard_ContentChanged(null, null);
            ParentShellPageInstance.NavigationToolbar.PathControlDisplayText = parameters.NavPathParam;
        }