private async void RecentFilesWidget_RecentFileInvoked(object sender, UserControls.PathNavigationEventArgs e) { try { var directoryName = Path.GetDirectoryName(e.ItemPath); await AppInstance.InteractionOperations.InvokeWin32ComponentAsync(e.ItemPath, workingDir : directoryName); } catch (UnauthorizedAccessException) { var consentDialog = new ConsentDialog(); await consentDialog.ShowAsync(); } catch (ArgumentException) { if (new DirectoryInfo(e.ItemPath).Root.ToString().Contains(@"C:\")) { AppInstance.ContentFrame.Navigate(FolderSettings.GetLayoutType(e.ItemPath), new NavigationArguments() { AssociatedTabInstance = AppInstance, NavPathParam = e.ItemPath }); } else { foreach (DriveItem drive in Enumerable.Concat(App.DrivesManager.Drives, AppSettings.CloudDrivesManager.Drives)) { if (drive.Path.ToString() == new DirectoryInfo(e.ItemPath).Root.ToString()) { AppInstance.ContentFrame.Navigate(FolderSettings.GetLayoutType(e.ItemPath), new NavigationArguments() { AssociatedTabInstance = AppInstance, NavPathParam = e.ItemPath }); return; } } } } catch (COMException) { await DialogDisplayHelper.ShowDialogAsync( "DriveUnpluggedDialog/Title".GetLocalized(), "DriveUnpluggedDialog/Text".GetLocalized()); } }
private async void RecentsView_ItemClick(object sender, ItemClickEventArgs e) { var path = (e.ClickedItem as RecentItem).RecentPath; try { var directoryName = Path.GetDirectoryName(path); await Interaction.InvokeWin32Component(path, workingDir : directoryName); } catch (UnauthorizedAccessException) { var consentDialog = new ConsentDialog(); await consentDialog.ShowAsync(); } catch (ArgumentException) { if (new DirectoryInfo(path).Root.ToString().Contains(@"C:\")) { App.CurrentInstance.ContentFrame.Navigate(AppSettings.GetLayoutType(), path); } else { foreach (DriveItem drive in AppSettings.DrivesManager.Drives) { if (drive.Path.ToString() == new DirectoryInfo(path).Root.ToString()) { App.CurrentInstance.ContentFrame.Navigate(AppSettings.GetLayoutType(), path); return; } } } } catch (COMException) { await DialogDisplayHelper.ShowDialog( "DriveUnpluggedDialog/Title".GetLocalized(), "DriveUnpluggedDialog/Text".GetLocalized()); } }