public RingMetaData CreateNewRingInstance() { RingPlayerDb playerDb = new RingPlayerDb(); playerDb.Set_DbProxy(new DirectHsServerSqlConnector { Catalog = RingPlayerDb.NativeName }); playerDb.LoadConstraints(); playerDb.SetHasBeenLoaded(); RingMetaData ring = playerDb.RingMetaDatas.NewRow(); ring.Id = 1; ring.SenderId = Guid.Empty; ring.CreationDate = DateTime.MinValue; ring.TargetDate = DateTime.MinValue; ring.Occasion = ""; ring.AddToTable(); return ring; }
private void MMUnitImageClicked_OnClick(object sender, RoutedEventArgs e) { MMUnit selectedMMUnit = (sender as Button).DataContext as MMUnit; //CREATE DATABASE RingPlayerDb ActuallPlayerDb = new RingPlayerDb(); ActuallPlayerDb.Set_DbProxy(new DirectHsServerSqlConnector{ Catalog = RingPlayerDb.NativeName }); ActuallPlayerDb.LoadConstraints(); ActuallPlayerDb.SetHasBeenLoaded(); //*************** //CREATE CONTENT new PageGroupGenerator(selectedMMUnit, ActuallPlayerDb).Generate(); //************** var downloader = ActuallPlayerDb.GetDependencyDownloader(); if (downloader == null) { OpenViewer(ActuallPlayerDb, $"{selectedMMUnit.NameId} ({selectedMMUnit.MMUnitTyp.TypNameId}) "); return; } Window wind = new Window() { Content = "Downloading" }; wind.Show(); downloader.Start().ContinueWith(t => { wind.Close(); if (t.Exception != null) MessageBox.Show($"Der download war nicht erfolgreich: {t.Exception.MostInner()?.Message}"); else OpenViewer(ActuallPlayerDb, $"{selectedMMUnit.NameId} ({selectedMMUnit.MMUnitTyp.TypNameId}) "); }, TaskScheduler.FromCurrentSynchronizationContext()); }