public async void Upgreid() { try { IReadOnlyList <StorageFolder> folderList = await(await StorageFolder.GetFolderFromPathAsync(Path)).GetFoldersAsync(); // storageFolder.GetFoldersAsync(); IReadOnlyList <StorageFile> fileList = await(await StorageFolder.GetFolderFromPathAsync(Path)).GetFilesAsync(); //storageFolderFirst = storageFolder; ListCol.Clear(); foreach (StorageFolder FlFolder1 in folderList) { //var thumbnail1 = await FlFolder1.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); // ListCol.Add(new ClassListStroce() { StorageFolder = FlFolder1, FlagFolde = true, Type = Type, ThumbnailMode=thumbnail1 }); ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, true, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), FileAndFolderViewer.Type) { ick = true }); // { StorageFolder = FlFolder1, FlagFolde = true, Type = Type }); } foreach (StorageFile FlFolder1 in fileList) { // var thumbnail1 = await FlFolder1.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, false, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), FileAndFolderViewer.Type) { ick = true }); // { storageFile = FlFolder1, FlagFolde = false, Type = Type, ThumbnailMode= thumbnail1 }); } } catch (Exception ex) { InitializeDataGridView(); } }
public async void FavoritSpeed() { if (simofor == false) { try { ListCol.Clear(); var items = Windows.Storage.UserDataPaths.GetDefault(); Path = items.Profile; StorageFolder storageFolder = await StorageFolder.GetFolderFromPathAsync(items.Profile); var d = await storageFolder.GetFoldersAsync(); foreach (StorageFolder FlFolder1 in d) { // var thumbnail = await FlFolder1.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); //ListCol.Add(new ClassListStroce() { StorageFolder = FlFolder1, FlagFolde = true, Type = Type, ThumbnailMode= thumbnail }); ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, true, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = FlFolder1, FlagFolde = true, Type = Type}); } var d1 = await storageFolder.GetFilesAsync(); foreach (StorageFile FlFolder1 in d1) { //var thumbnail = await FlFolder1.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, false, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), Type) { ick = true }); // { storageFile = FlFolder1, FlagFolde = false, Type = Type, ThumbnailMode= thumbnail }); } } catch (Exception ex) { simofor = false; Debug.WriteLine(ex.ToString()); } } }
public async void Sorting(string tipselect)//tipselect UpABC, DownABC, UpDate, DownDate { List <ClassListStroce> classListStroces = new List <ClassListStroce>(); List <ClassListStroce> classListStroces1 = new List <ClassListStroce>(); if (tipselect == "UpABC") { classListStroces1 = (from FolderInfo in ListCol orderby FolderInfo.FileAndFildeName select FolderInfo).ToList(); } if (tipselect == "DownABC") { classListStroces1 = (from FolderInfo in ListCol orderby FolderInfo.FileAndFildeName descending select FolderInfo).ToList(); } foreach (var d in classListStroces1) { classListStroces.Add(d); } ListCol.Clear(); foreach (var d in classListStroces) { // fileAndFolderViewer.ListCol.Add(d); if (d.FlagFolde) { // var thumbnail1 = await d.StorageFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(d);// { StorageFolder = d.StorageFolder, FlagFolde = true, Type = d.Type, ThumbnailMode = thumbnail1 }); } else { // var thumbnail1 = await d.storageFile.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(d);// { storageFile = d.storageFile, FlagFolde = false, Type = d.Type, ThumbnailMode = thumbnail1 }); } } }
public async void Next(ClassListStroce classListStroce) { if (simofor == false) { try { VicProgres = Visibility.Visible; ListCol.Clear(); simofor = true; if (classListStroce.FlagFolde) { var watch = Stopwatch.StartNew(); watch.Start(); Path = classListStroce.Path; IReadOnlyList <StorageFolder> folderList = await(await StorageFolder.GetFolderFromPathAsync(classListStroce.Path)).GetFoldersAsync(); winProgres = folderList.Count(); // IReadOnlyList<StorageFile> fileList = await (await StorageFolder.GetFolderFromPathAsync(classListStroce.Path)).GetFilesAsync(); //var fileList1 = await classListStroceSelect.ElementAt(0).StorageFolder.GetItemsAsync(); foreach (StorageFolder FlFolder1 in folderList) { // var thumbnail = await FlFolder1.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, true, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = FlFolder1, FlagFolde = true, Type = Type }); //ListCol.Add(new ClassListStroce() { StorageFolder = FlFolder1, FlagFolde = true, Type = Type, ThumbnailMode = thumbnail }); } stepProgres = folderList.Count(); IReadOnlyList <StorageFile> fileList = await(await StorageFolder.GetFolderFromPathAsync(classListStroce.Path)).GetFilesAsync(); winProgres = winProgres + fileList.Count(); foreach (StorageFile FlFolder1 in fileList) { // var thumbnail = await FlFolder1.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, false, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), Type) { ick = true }); // { storageFile = FlFolder1, FlagFolde = false, Type = Type, ThumbnailMode= thumbnail }); } stepProgres += fileList.Count(); watch.Stop(); Debug.WriteLine(watch.ElapsedMilliseconds.ToString()); //_DataGrid.SelectedIndex = 0; classListStroceSelect = null; } else { await ActivateFile(await StorageFile.GetFileFromPathAsync(classListStroce.Path)); } simofor = false; } catch (Exception ex) { simofor = false; } finally { simofor = false; VicProgres = Visibility.Collapsed; } } }
public async void InitializeDataGridView() { listDostyp.Clear(); // A TreeView can have more than 1 root node. The Pictures library // and the Music library will each be a root node in the tree. // Get Pictures library. try { ListCol.Clear(); try { StorageFolder storageFolder = await StorageFolder.GetFolderFromPathAsync(Windows.Storage.UserDataPaths.GetDefault().Desktop); //var thumbnailddes =await storageFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(storageFolder.Path, storageFolder.DisplayName, true, storageFolder.DisplayType, storageFolder.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = storageFolder, FlagFolde = true, Type = Type, ThumbnailMode= thumbnailddes }); // ListCol.Add(new ClassListStroce() { StorageFolder = storageFolder, FlagFolde = true, Type = Type}); } catch (Exception ex) { } try { StorageFolder storageFolderDownloads = await StorageFolder.GetFolderFromPathAsync(Windows.Storage.UserDataPaths.GetDefault().Downloads); //var thumbnailddesDownloads = await storageFolderDownloads.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(storageFolderDownloads.Path, storageFolderDownloads.DisplayName, true, storageFolderDownloads.DisplayType, storageFolderDownloads.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = storageFolderDownloads, FlagFolde = true, Type = Type, ThumbnailMode= thumbnailddesDownloads }); } catch (Exception ex) { } // StorageFolder DocumentFolder = KnownFolders.DocumentsLibrary; StorageFolder DocumentFolder = await StorageFolder.GetFolderFromPathAsync(Windows.Storage.UserDataPaths.GetDefault().Documents); // var thumbnaild = await DocumentFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.ResizeThumbnail); //Debug.WriteLine(KnownFolders.DocumentsLibrary.Path); ListCol.Add(new ClassListStroce(DocumentFolder.Path, DocumentFolder.DisplayName, true, DocumentFolder.DisplayType, DocumentFolder.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = DocumentFolder, FlagFolde = true, Type = Type, ThumbnailMode= thumbnaild }); StorageFolder picturesFolder = await StorageFolder.GetFolderFromPathAsync(Windows.Storage.UserDataPaths.GetDefault().Pictures); //var thumbnail = await picturesFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(picturesFolder.Path, picturesFolder.DisplayName, true, picturesFolder.DisplayType, picturesFolder.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = picturesFolder, FlagFolde = true, Type = Type, ThumbnailMode= thumbnail }); // Get Music library. StorageFolder musicFolder = await StorageFolder.GetFolderFromPathAsync(Windows.Storage.UserDataPaths.GetDefault().Music);; // var thumbnail1 = await picturesFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(musicFolder.Path, musicFolder.DisplayName, true, musicFolder.DisplayType, musicFolder.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = musicFolder, FlagFolde = true, Type = Type, ThumbnailMode= thumbnail1 }); var storageItemAccessList = Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList; if (storageItemAccessList.Entries.Count != 0) { foreach (Windows.Storage.AccessCache.AccessListEntry entry in storageItemAccessList.Entries) { string mruToken = entry.Token; string mruMetadata = entry.Metadata; Windows.Storage.IStorageItem item = await storageItemAccessList.GetItemAsync(mruToken); listDostyp.Add(mruToken); StorageFolder ss = await storageItemAccessList.GetFolderAsync(mruToken); //var thumbnail11 = await picturesFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(ss.Path, ss.DisplayName, true, ss.DisplayType, ss.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = ss, FlagFolde = true, ThumbnailMode = thumbnail11, Type = Type }); } } try { var items = Windows.Storage.UserDataPaths.GetDefault(); StorageFolder storageFolder = await StorageFolder.GetFolderFromPathAsync(items.Profile); var d = await storageFolder.GetFoldersAsync(); foreach (StorageFolder FlFolder1 in d) { if (FlFolder1.DisplayName == "OneDrive") { //var thumbnailr = await FlFolder1.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); ListCol.Add(new ClassListStroce(FlFolder1.Path, FlFolder1.DisplayName, true, FlFolder1.DisplayType, FlFolder1.DateCreated.ToString(), Type) { ick = true }); // { StorageFolder = FlFolder1, FlagFolde = true, Type = Type, ThumbnailMode= thumbnailr }); } } } catch (Exception ex) { } var f = GetInternalDrives(); foreach (var d in f) { Debug.WriteLine(d.DisplayName); } DriveInfo[] drives = DriveInfo.GetDrives(); foreach (DriveInfo drive in drives) { try { if (drive.DriveType == DriveType.Fixed && drive.DriveType != DriveType.Removable) { StorageFolder FolderL = await StorageFolder.GetFolderFromPathAsync(drive.Name); var thumbnailL = await FolderL.GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 60, ThumbnailOptions.UseCurrentScale); var clas = new ClassListStroce(FolderL.Path, FolderL.DisplayName, true, FolderL.DisplayType, FolderL.DateCreated.ToString(), Type) { ick = true, ThumbnailMode = thumbnailL }; // { StorageFolder = FolderL, FlagFolde = true, ThumbnailMode= thumbnailL }; if (Type == "Maximum") { clas.Type = "Drive"; } else { clas.Type = "DriveMiddle"; } try { clas.Spase(); } catch (Exception ex) { } ListCol.Add(clas); } } catch (Exception) { } } StorageFolder Folder = KnownFolders.RemovableDevices; try { //IReadOnlyList<StorageFolder> folderList = await Folder.GetFoldersAsync(); //foreach (StorageFolder FlFolder1 in folderList) { // thumbnail1 = await FlFolder1.GetThumbnailAsync(ThumbnailMode.SingleItem, 100); // ListCol.Add(new ClassListStroce() { StorageFolder = FlFolder1, FlagFolde = true, ThumbnailMode = thumbnail1, Type = Type }); } } catch (Exception) { } Path = String.Empty; } catch (UnauthorizedAccessException ex) { var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); MessageDialog messageDialog = new MessageDialog(resourceLoader.GetString("MessageContentDostup"), resourceLoader.GetString("MessageTiletDostup")); await messageDialog.ShowAsync(); App.Current.Exit(); } catch (Exception ex) { MessageDialog messageDialog = new MessageDialog(ex.Message); await messageDialog.ShowAsync(); } }