async void InitializeDBs() { if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(new DependencyObject())) { //TODO: put some dummy components here for design time } // Trying to load this stuff at design time will throw an exception and crash the designer else { Datomatic datomatic = null; await Task.Run(() => { datomatic = new Datomatic(); }); IDBs.Add(datomatic); GamesDB gamesDB = null; await Task.Run(() => { gamesDB = new GamesDB(); }); IDBs.Add(gamesDB); GiantBomb giantBomb = null; await Task.Run(() => { giantBomb = new GiantBomb(); }); IDBs.Add(giantBomb); OpenVGDB openVGDB = null; await Task.Run(() => { openVGDB = new OpenVGDB(); }); IDBs.Add(openVGDB); Launchbox launchBox = null; await Task.Run(() => { launchBox = new Launchbox(); }); IDBs.Add(launchBox); } }
async void GetAllData() { // TODO: make this good for any idbobject and add get selected data command Stopwatch Watch = Stopwatch.StartNew(); Stopwatch Watch1 = Stopwatch.StartNew(); int j = 0; await Task.Run(() => { Reporter.Report("Opening local cache..."); R.Data.GBReleases.Load(); R.Data.GDBReleases.Load(); R.Data.OVGReleases.Load(); R.Data.LBReleases.Include(x => x.LBGame).Load(); Reporter.ReportInline(Watch.Elapsed.ToString("ss") + " s"); Watch.Restart(); int count = R.Data.Releases.Count(); foreach (Release release in R.Data.Releases) { if (j++ % (count / 10) == 0) { Reporter.Report("Copying " + j + @" / " + count + " " + Watch.Elapsed.ToString(@"m\:ss") + " elapsed."); Watch.Restart(); } release.CopyData(); } }); Datomatic datomatic = new Datomatic(); datomatic.ReportUpdates(true); R.Data.Save(false); }