public async void UpdateButton_Click() { using (var pb = new ProgressWindow()) { pb.AddStacks(MangaIndex.Providers); pb.Show(); await MangaIndex.Update(pb.GetProgress); } }
private static async Task Populate(params ISeriesParser[] parser) { var options = new ProgressBarOptions { ForegroundColor = ConsoleColor.Yellow, BackgroundColor = ConsoleColor.DarkYellow, ProgressCharacter = '─' }; var memCache = new MemFile(); var manager = new MangaDownloader(new FileSystem(), parser, Client2.GetDocumentAsync); var index = new MangaIndex(manager, null, memCache); var first = true; ConsoleProgress pb = null; IProgress <double> GetProgress(string context) { pb?.Dispose(); if (first) { first = false; } else { Console.WriteLine(); Console.WriteLine(); } return(pb = new ConsoleProgress(options, context)); } try { await index.Update(GetProgress); } catch (Exception e) { Console.WriteLine(e.Message); } //res = await Task.WhenAll(manager.Providers.Select(p => manager.ListInstances(p, pb).ContinueWith(t => (t.Result, provider: p)))); //var res = await MyDictionary; //MyDictionary = new AsyncLazy<Dictionary<string, MangaInfo>>(CreateDictionary); }