public async void TextProperty(ClassListStroce cc)
        {
            var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();



            // Get file's basic properties.
            Windows.Storage.FileProperties.BasicProperties basicProperties =
                await(await StorageFolder.GetFolderFromPathAsync(cc.Path)).GetBasicPropertiesAsync();


            string fileSize = string.Format("{0:n0}", basicProperties.Size);


            //  Windows.Storage.FileAttributes folderAttributes = cc.storageFile.Attributes;

            // if ((folderAttributes & Windows.Storage.FileAttributes.ReadOnly) == Windows.Storage.FileAttributes.ReadOnly)
            // Debug.WriteLine("The item is read-only.");

            //  if ((folderAttributes & Windows.Storage.FileAttributes.Directory) == Windows.Storage.FileAttributes.Directory)
            // Debug.WriteLine("The item is a folder.");

            //  if ((folderAttributes & Windows.Storage.FileAttributes.Archive) == Windows.Storage.FileAttributes.Archive)
            //  Debug.WriteLine("The item is archived.");

            //  if ((folderAttributes & Windows.Storage.FileAttributes.Temporary) == Windows.Storage.FileAttributes.Temporary)
            //   Debug.WriteLine("The item is temporary.");


            textName.Text = resourceLoader.GetString("NameText") + ": " + (await StorageFolder.GetFolderFromPathAsync(cc.Path)).Name;
            var thumbnaildstorageFolder = await(await StorageFolder.GetFolderFromPathAsync(cc.Path)).GetScaledImageAsThumbnailAsync(ThumbnailMode.SingleItem, 40, ThumbnailOptions.UseCurrentScale);

            // MessageDialog messageDialog = new MessageDialog(fileProperties.ToString(), resourceLoader.GetString("InfoText"));
            //await messageDialog.ShowAsync();
            this.Title = resourceLoader.GetString("InfoText");
            BitmapImage          image     = null;
            StorageItemThumbnail thumbnail = (StorageItemThumbnail)thumbnaildstorageFolder;

            image = new BitmapImage();
            image.SetSource(thumbnail);
            img.Source = image;



            textTip.Text  = resourceLoader.GetString("TipText") + ": ";
            textTip1.Text = (await StorageFolder.GetFolderFromPathAsync(cc.Path)).DisplayType;

            textpath.Text  = resourceLoader.GetString("PathText") + ": ";
            textpath1.Text = (await StorageFolder.GetFolderFromPathAsync(cc.Path)).Path;

            textcreate.Text  = resourceLoader.GetString("CreatText") + ": ";
            textcreate1.Text = (await StorageFolder.GetFolderFromPathAsync(cc.Path)).DateCreated.ToString();
            textizm.Text     = resourceLoader.GetString("IzmenText") + ": ";
            textizm1.Text    = basicProperties.DateModified.ToLocalTime().ToString();

            // textsize.Text = resourceLoader.GetString("SizeText") + ": ";
            //  textsize1.Text = GetFileSize(basicProperties);
        }
Exemple #2
0
        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;
                }
            }
        }
Exemple #3
0
        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();
            }
        }