Example #1
0
        /// <summary>
        /// This method gets called when your Controller should be initialized.
        /// Perform additional initialization of your UserControl here.
        /// </summary>
        protected static void Initialize()
        {
            Messenger.AddListener(Instance);

            EventDistributor.AsyncTaskStarted += AsyncTaskStarted;
            EventDistributor.AsyncTaskDone    += AsyncTaskDone;
            EventDistributor.LanguageChanged  += LanguageChanged;
            EventDistributor.KSPRootChanging  += KSPRootChanging;
            EventDistributor.KSPRootChanged   += KSPRootChanged;
            EventDistributor.KSPMAStarted     += KSPMAStarted;

            CreateConfigDir();
            LoadConfigs();

            LoadPlugins();

            View.TapOrder = LastTabOrder;

            OptionsController.AvailableLanguages = Localizer.GlobalInstance.AvailableLanguages;
            OptionsController.SelectedLanguage   = Localizer.GlobalInstance.CurrentLanguage;

            LoadSiteHandler();

            if (!KSPPathHelper.IsKSPInstallFolder(OptionsController.SelectedKSPPath))
            {
                frmWelcome dlg = new frmWelcome();
                if (dlg.ShowDialog(View) != DialogResult.OK)
                {
                    View.Close();
                    return;
                }

                OptionsController.AddKSPPath(dlg.KSPPath);
                OptionsController.SelectedKSPPath = dlg.KSPPath;
            }

            // Initializing is done.
            EventDistributor.InvokeKSPMAStarted(Instance);
        }
 /// <summary>
 /// Handles the Click event of the btnAddPath.
 /// </summary>
 private void BtnAddPath_Click(object sender, EventArgs e)
 {
     OptionsController.AddKSPPath();
 }