Beispiel #1
0
        private void Init()
        {
            Timetable.DefaultLinearVersion = Settings.GetEnum("core.default-file-format", Timetable.DefaultLinearVersion);
            FontCollection.InitAsync();     // Asynchron Liste von verfügbaren Schriftarten laden
            EtoExtensions.Initialize(this); // UI-Erweiterungen initialiseren
            this.AddSizeStateHandler();

            // Extensions laden & initialisieren (=> Initialisiert Importer/Exporter)
            extensionManager.LoadExtensions();
            extensionManager.InitActivatedExtensions();

            InitializeExportImport();
            InitializeMenus();

            // Vorlagen laden
            templatePath    = Settings.Get("tmpl.root", templatePath);
            templateManager = new TemplateManager(registry, Logger, Settings);
            templateManager.LoadTemplates(templatePath);
            if (OptionsParser.TemplateDebug)
            {
                Task.Run(() => Application.Instance.Invoke(() => templateManager.DebugCompileAll()));
            }

            ExtensionsLoaded?.Invoke(this, new EventArgs());

            Shown += (s, e) => LoadStartFile();
            Shown += (s, e) => update.AutoUpdateCheck(Logger);

            checkRunner = new TimetableChecks.TimetableCheckRunner(this); // CheckRunner initialisieren

            // Hatten wir einen Crash beim letzten Mal?
            if (crashReporter.HasCurrentReport)
            {
                Shown += (s, e) =>
                {
                    try
                    {
                        var cf = new CrashReporting.CrashForm(crashReporter);
                        if (cf.ShowModal(this) == DialogResult.Ok)
                        {
                            crashReporter.Restore(fileHandler);
                        }
                        crashReporter.RemoveCrashFlag();
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("Fehlermeldung des letzten Absturzes konnte nicht angezeigt werden: " + ex.Message);
                        crashReporter.RemoveCrashFlag(); // Der Crash crasht sogar noch die Fehlerbehandlung...
                    }
                };
            }
        }
Beispiel #2
0
        public void BootstrapExtensions()
        {
            if (Logger == null || RootForm == null)
            {
                throw new InvalidOperationException("Bootstrapper was not fully initialized before attempted to bootstrap extensions!");
            }

            if (!extensionsPreLoaded)
            {
                throw new InvalidOperationException("Extensions have not been preloaded before attempting to initializing them!");
            }

            // Initialize (already loaded) extensions (==> base for the next steps)
            ExtensionManager.InitActivatedExtensions(registry);

            // Initialize Export/Import
            var exporters = GetRegistered <IExport>();
            var importers = GetRegistered <IImport>();

            FileHandler.InitializeExportImport(exporters, importers);

            // Load templates from files & extensions
            var templatePath    = settings.Get("tmpl.root", DEFAULT_TEMPLATE_PATH);
            var templateManager = new TemplateManager(registry, this, templatePath);

            templateManager.LoadTemplates(templatePath);
            if (OptionsParser.TemplateDebug)
            {
                Task.Run(() => Application.Instance.Invoke(() => templateManager.DebugCompileAll()));
            }
            TemplateManager = templateManager;

            ExtensionsLoaded?.Invoke(this, new EventArgs());

            (RootForm as Window) !.Closing += (s, e) => AppClosing?.Invoke(this, null);
        }