LongoMatch.MainClass.Init C# (CSharp) Method

Init() static private method

static private Init ( SplashScreen splashScreen ) : Task
splashScreen SplashScreen
return Task
		static async Task Init (SplashScreen splashScreen)
		{
			IProgressReport progress = splashScreen;

			try {
				bool haveCodecs = false;
				App.Current.DrawingToolkit = new CairoBackend ();
				App.Current.MultimediaToolkit = new MultimediaToolkit ();
				App.Current.GUIToolkit = GUIToolkit.Instance;
				App.Current.Navigation = GUIToolkit.Instance;
				App.Current.GUIToolkit.Register<IPlayerView, VASUi.PlayerView> (0);
				App.Current.Dialogs = VASUi.Dialogs.Instance;

				App.Current.KPIService.Init ("9dc114d23c6148719b4adbe585b811cc", "user", "email");

				Task gstInit = Task.Factory.StartNew (() => InitGStreamer (progress));

				App.Current.DependencyRegistry.Register<IFileStorage, LMDB.FileStorage> (0);
				InitAddins (progress);
				CoreServices.RegisterService (new UpdatesNotifier ());
				CoreServices.Start (App.Current.GUIToolkit, App.Current.MultimediaToolkit);
				AddinsManager.LoadDashboards (App.Current.CategoriesTemplatesProvider);
				AddinsManager.LoadImportProjectAddins (CoreServices.ProjectsImporter);

				// Migrate the old databases now that the DB and Templates services have started
				DatabaseMigration dbMigration = new DatabaseMigration (progress);
				Task dbInit = Task.Factory.StartNew (dbMigration.Start);

				// Wait for Migration and the GStreamer initialization
				try {
					await Task.WhenAll (gstInit, dbInit);
				} catch (AggregateException ae) {
					throw ae.Flatten ();
				}

				if (!AddinsManager.RegisterGStreamerPlugins ()) {
					ShowCodecsDialog ();
				}

				splashScreen.Destroy ();
				ConfigureOSXApp ();
				(GUIToolkit.Instance.MainController as MainWindow).Initialize ();
				App.Current.StateController.SetHomeTransition ("Home", null);
			} catch (Exception ex) {
				ProcessExecutionError (ex);
			}
		}