public async Task addLocation() { try { var folderPicker = new Windows.Storage.Pickers.FolderPicker(); folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; folderPicker.FileTypeFilter.Add("*"); Windows.Storage.StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { // Application now has read/write access to all contents in the picked folder // (including other sub-folder contents) StorageApplicationPermissions.FutureAccessList.AddOrReplace(folder.DisplayName, folder); } else { } fileAndFolderViewer.ListCol.Clear(); ViewLeft.InitializeTreeView(); ViewRight.InitializeTreeView(); InitializeDataGridView(); } catch (Exception ex) { await new MessageDialog(ex.Message).ShowAsync(); } }
private void AppBarButton_Click_3(object sender, RoutedEventArgs e) { try { //Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Remove(listDop.SelectedItem.ToString()); Upgreid(); ViewLeft.InitializeTreeView(); ViewRight.InitializeTreeView(); } catch (Exception ex) { } }
public async void newUsB() { try { StorageFolder Folder = KnownFolders.RemovableDevices; IReadOnlyList <StorageFolder> folderList = await Folder.GetFoldersAsync(); if (ViewLeft.fileAndFolderViewer.ListUSB.Count > 0) { try { foreach (var FlFolder1 in ViewLeft.fileAndFolderViewer.ListUSB) { var f = (from d in folderList where d.DisplayName == FlFolder1.DisplayName select d).Count(); if (f == 0) { ViewLeft.fileAndFolderViewer.ListUSB.Remove(FlFolder1); await Dispatcher.RunAsync(CoreDispatcherPriority.High, async() => { if (ViewLeft.fileAndFolderViewer.Path == String.Empty) { //InitializeDataGridView1(); ViewLeft.fileAndFolderViewer.InitializeDataGridView(); } if (ViewRight.fileAndFolderViewer.Path == String.Empty) { ViewRight.fileAndFolderViewer.InitializeDataGridView(); } ViewRight.InitializeTreeView(); ViewLeft.InitializeTreeView(); }); } } } catch (Exception ex) { await new MessageDialog(ex.Message).ShowAsync(); } } foreach (StorageFolder FlFolder1 in folderList) { var f = (from d in ViewLeft.fileAndFolderViewer.ListUSB where d.DisplayName == FlFolder1.DisplayName select d).Count(); if (f == 0) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, async() => { if (ViewLeft.fileAndFolderViewer.Path == String.Empty) { // var thumbnail1 = await FlFolder1.GetThumbnailAsync(ThumbnailMode.SingleItem, 100); ViewLeft.fileAndFolderViewer.ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, true, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), FileAndFolderViewer.Type) { ick = true }); // { StorageFolder = FlFolder1, FlagFolde = true, ThumbnailMode = thumbnail1, Type = FileAndFolderViewer.Type }); } if (ViewRight.fileAndFolderViewer.Path == String.Empty) { // var thumbnail1 = await FlFolder1.GetThumbnailAsync(ThumbnailMode.SingleItem, 100); ViewRight.fileAndFolderViewer.ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, true, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), FileAndFolderViewer.Type) { ick = true }); // { StorageFolder = FlFolder1, FlagFolde = true, ThumbnailMode = thumbnail1, Type = FileAndFolderViewer.Type }); } ViewLeft.fileAndFolderViewer.ListUSB.Add(FlFolder1); ViewRight.InitializeTreeView(); ViewLeft.InitializeTreeView(); }); } } } catch (Exception ex) { //await new MessageDialog(ex.Message).ShowAsync(); } }