예제 #1
0
        public ConfigDialog(ITranslation i18n, OpenBveLocalRegistry registry)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            foreach (Control ctrl1 in Controls)
            {
                if (!string.IsNullOrEmpty(ctrl1.Tag as string))
                {
                    ctrl1.Text = i18n.Translate("bpmplugin_openbve_configform_" + ctrl1.Tag as string);
                }
                foreach (Control ctrl2 in ctrl1.Controls)
                {
                    if (!string.IsNullOrEmpty(ctrl2.Tag as string))
                    {
                        ctrl2.Text = i18n.Translate("bpmplugin_openbve_configform_" + ctrl2.Tag as string);
                    }
                }
            }
            Text = i18n.Translate("bpmplugin_openbve_configform_title", registry.GetHashCode().ToString("X8"));

            this.registry     = registry;
            this.i18n         = i18n;
            textDatabase.Text = registry.DatabaseFolder;
            textRailway.Text  = registry.RouteInstallationDirectory;
            textTrain.Text    = registry.TrainInstallationDirectory;
            textOther.Text    = registry.OtherInstallationDirectory;
            textLoksim.Text   = registry.LoksimPackageInstallationDirectory;
        }
예제 #2
0
        void TextBoxTextChanged(object sender, EventArgs e)
        {
            ApplyToRegistry(ref checkRegistry);
            var isValid = checkRegistry.CheckConfig();

            if (isValid)
            {
                Text = i18n.Translate("bpmplugin_openbve_configform_title", checkRegistry.GetHashCode().ToString("x8"));
            }
            else
            {
                Text = i18n.Translate("bpmplugin_openbve_configform_title", "Invalid!");
            }
            btnOK.Enabled   = isValid;
            btnOK.BackColor = btnColors[isValid ? 1 : 0];
        }