public async Task loadTitles(IProgress <int> progress, CancellationToken ct, ProgressBar prg) { ArtistNames.Clear(); int mprogress = 0; // integer variable for progress report prg.Value = 0; int totalFiles = System.IO.Directory.EnumerateFiles(GlobalData.Config.DataPath, "*.jpg", SearchOption.AllDirectories).Count(); foreach (string line in System.IO.Directory.EnumerateFiles(GlobalData.Config.DataPath, "*.jpg", SearchOption.AllDirectories)) { if (!ct.IsCancellationRequested) { mprogress += 1; progress.Report((mprogress * 100 / totalFiles)); ShellFile item = ShellFile.FromFilePath(line); ArtistNames.Add(new ArtistData { Name = item.Properties.System.Title.Value, Tag = line }); await Task.Delay(5); } } }
public void loadArtists() { ArtistNames.Clear(); foreach (var item in Directory.EnumerateDirectories(GlobalData.Config.DataPath)) { ArtistNames.Add(new ArtistData { Name = item.Replace(System.IO.Path.GetDirectoryName(item) + System.IO.Path.DirectorySeparatorChar, "") }); } }
public void loadArtists() { ArtistNames.Clear(); foreach (string line in System.IO.Directory.EnumerateDirectories(GlobalData.Config.DataPath)) { ArtistNames.Add(new ArtistData { Name = line.Replace(Path.GetDirectoryName(line) + Path.DirectorySeparatorChar, "") }); } }
public void loadCity() { ArtistNames.Clear(); var cityResource = Properties.Resources.city; var cityItems = cityResource.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in cityItems) { ArtistNames.Add(new ArtistData { Name = item }); } }
public void loadGallery() { ArtistNames.Clear(); string galleryResource = Properties.Resources.gallery; string[] galleryItems = galleryResource.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); foreach (string item in galleryItems) { ArtistNames.Add(new ArtistData { Name = item }); } }