Пример #1
0
        private async Task Main_Load(object sender, EventArgs e)
        {
            IoC.Notif.ShowStatus("Loading config...");

            IoC.Bind(new Archiver());
            IoC.Bind(new Localization(ELanguage.English));

            Settings = new SettingsControl();
            Plugins  = (
                from plugin in PluginManager.LoadAll <IInteractivePlugin>()
                let idx = IoC.Config.PluginLoadOrder.IndexOf(plugin.PluginName)
                          let order = idx < 0 ? int.MaxValue : idx
                                      orderby order, plugin.PluginName
                select plugin).ToList();

            IoC.Notif.ShowStatus("Loading Plugins...");
            foreach (var module in Plugins.AsEnumerable().Concat(new[] { Settings }).Reverse())
            {
                var tab = new TabItem();

                tab.Header  = module.PluginName;
                tab.Content = module.PluginControl;

                tcMain.Items.Insert(0, tab);
            }

            await Settings.Initialize();

            Settings.SettingsOkay += Settings_SettingsOkayCommand;

            IoC.Notif.ShowUnknownProgress();

            await RunCompatibility();

            tcMain.SelectedIndex = 0;
            if (!await InitializePlugins())
            {
                tcMain.SelectedIndex = tcMain.Items.Count - 1;
            }

            IoC.Notif.HideProgress();
            IoC.Notif.ShowStatus("Loading complete");
        }