Example #1
0
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     try
     {
         Assembly a = Assembly.LoadFrom(Console.Properties.Settings.Default.DataProviderLibrary);
         ProviderType = a.GetType(Console.Properties.Settings.Default.DataProviderClass);
         Provider = (IDataProvider)Activator.CreateInstance(ProviderType);
     }
     catch (Exception ex)
     {
         string m = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
         Message(
             "Fehler beim Aufstarten des konfigurierten Datenproviders: " + 
             m + 
             "\nDie Anwendung wird nun beendet.",
             MessageType.Error);
         Shutdown(1);
         return;
     }
     MainView = new MainViewModel();
     MainView.ShowPage(new SplashViewModel());
     Task t = new Task(new Action<object>(Provider.Startup), null);
     t.Start();
     Task.WaitAny(new Task[] { t });
     this.MainWindow = MainView.GetWindow();
     MainView.SetDefaultView(typeof(OverViewModel));
     MainView.ShowPage(new OverViewModel());
 }