public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); foreach (var path in Directory.PathStack) { PathStack.Add(path); } var parameters = FileInfoPageParameters.Deserialize(e.Parameter); var resourceInfo = parameters?.ResourceInfo; if (resourceInfo == null) { return; } PathStack.Add(new PathInfo { ResourceInfo = resourceInfo }); ResourceInfo = resourceInfo; FileExtension = Path.GetExtension(ResourceInfo.Name); FileName = Path.GetFileNameWithoutExtension(ResourceInfo.Name); var converter = new BytesToHumanReadableConverter(); FileSizeString = LocalizationService.Instance.GetString( "FileSizeString", converter.Convert(ResourceInfo.Size, typeof(string), null, CultureInfo.CurrentCulture.ToString()), ResourceInfo.Size ); DownloadPreviewImages(); }
public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { Directory = DirectoryService.Instance; StartDirectoryListing(); _isNavigatingBack = false; if (e.Parameter != null) { var parameter = FileInfoPageParameters.Deserialize(e.Parameter); SelectedFileOrFolder = parameter?.ResourceInfo; } }
protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args) { // Ensure the current window is active Window.Current.Activate(); // Remove unnecessary notifications whenever the app is used. ToastNotificationManager.History.RemoveGroup(ToastNotificationService.SyncAction); PinStartPageParameters pageParameters = null; if (!string.IsNullOrEmpty(args?.Arguments)) { var tmpResourceInfo = JsonConvert.DeserializeObject <ResourceInfo>(args.Arguments); if (tmpResourceInfo != null) { pageParameters = new PinStartPageParameters() { ResourceInfo = tmpResourceInfo, PageTarget = tmpResourceInfo.IsDirectory ? PageToken.DirectoryList : PageToken.FileInfo }; } } if (SettingsService.Default.Value.LocalSettings.UseWindowsHello) { CheckSettingsAndContinue(PageToken.Verification, pageParameters); } else { IPageParameters resourceInfoPageParameters = null; if (pageParameters?.PageTarget == PageToken.DirectoryList) { resourceInfoPageParameters = new DirectoryListPageParameters { ResourceInfo = pageParameters?.ResourceInfo }; } else if (pageParameters?.PageTarget == PageToken.FileInfo) { resourceInfoPageParameters = new FileInfoPageParameters { ResourceInfo = pageParameters?.ResourceInfo }; } CheckSettingsAndContinue(pageParameters?.PageTarget ?? PageToken.DirectoryList, resourceInfoPageParameters); } return(Task.FromResult(true)); }