public void PopulateFileList(string path) { CurrentViewPc.Text = path; try { PcDetailsContainer.Children.Clear(); List <string> folders = Scan.IdentifyFolderNames(path); foreach (string folder in folders) { string name = folder; string Path = "\\\\" + path + "\\" + folder.TrimEnd(); List <string> ImageList = new List <string>(); List <string> VideoList = new List <string>(); List <string> AudioList = new List <string>(); List <string> TextList = new List <string>(); ImageList = SegLibrary.Seperate.GetImages(@Path); AudioList = SegLibrary.Seperate.GetAudios(@Path); VideoList = SegLibrary.Seperate.GetVideos(@Path); TextList = SegLibrary.Seperate.GetDocs(@Path); var size = SharePage.DirSize(new System.IO.DirectoryInfo(@Path)); FolderTile f = new FolderTile(name, path, VideoList.Count.ToString(), AudioList.Count.ToString(), TextList.Count.ToString(), ImageList.Count.ToString(), size); f.DownloadThis.Tag = Path; f.DownloadThis.Click += (sender1, ex) => this.DownloadItem(sender1, ex, @f.DownloadThis.Tag.ToString()); f.MouseDoubleClick += (sender1, ex) => this.ExploreItem(@f.DownloadThis.Tag.ToString()); PcDetailsContainer.Children.Add(f); } } catch (Exception e) { Console.WriteLine("Exception thrown ! No Access"); Console.WriteLine(e + path); } }
private async void ExploreItem(string path) { await Task.Delay(5); int indexFrom, indexLength; List <string> Inner = new List <string>(); string Path = path; SegLibrary.Seperate.CurrSearch(path, new System.Text.RegularExpressions.Regex(".*"), Inner); PcDetailsContainer.Children.Clear(); NavigationButton t = new NavigationButton(); try { int i = Path.LastIndexOf('\\') + 1; Console.WriteLine("Location : " + Path.LastIndexOf('\\') + " Path : " + Path.Substring(i)); t.Display.Text = Path.Substring(i); t.PathInfo.Tag = Path; t.MouseDoubleClick += (sender, ex) => NavigationButtonClick(t); } catch (Exception Ex) { Console.WriteLine(Ex); } FolderPathPanel.Children.Add(t); foreach (string name in Inner) { indexFrom = name.LastIndexOf('\\') + 1; indexLength = name.Length; Path = path + "\\" + name.Substring(indexFrom); if (Directory.Exists(@Path)) { List <string> ImageList = new List <string>(); List <string> VideoList = new List <string>(); List <string> AudioList = new List <string>(); List <string> TextList = new List <string>(); ImageList = SegLibrary.Seperate.GetImages(@Path); AudioList = SegLibrary.Seperate.GetAudios(@Path); VideoList = SegLibrary.Seperate.GetVideos(@Path); TextList = SegLibrary.Seperate.GetDocs(@Path); var size = SharePage.DirSize(new System.IO.DirectoryInfo(@Path)); FolderTile tile = new FolderTile(name.Substring(indexFrom, indexLength - indexFrom), Path, VideoList.Count.ToString(), AudioList.Count.ToString(), TextList.Count.ToString(), ImageList.Count.ToString(), size); tile.DownloadThis.Tag = Path; tile.DownloadThis.Click += (sender1, ex) => this.DownloadItem(sender1, ex, @tile.DownloadThis.Tag.ToString()); tile.MouseDoubleClick += (sender1, ex) => this.ExploreItem(@tile.DownloadThis.Tag.ToString()); PcDetailsContainer.Children.Add(tile); } else { FolderTiles tile = new FolderTiles(name.Substring(indexFrom, indexLength - indexFrom)); tile.FolderName.Tag = Path; string tempPath = Path.Substring(Path.LastIndexOf("\\") + 1); tile.MouseDoubleClick += (sender, ex) => RunFile(@tile.FolderName.Tag.ToString()); tile.DownloadThis.Click += (sender, ex) => this.DownloadItem(sender, ex, @tile.FolderName.Tag.ToString()); PcDetailsContainer.Children.Add(tile); } Console.WriteLine(@Path); } }