示例#1
0
        private void LanguageBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            CultureNameAndInfo cnai = this.languageBox.SelectedItem as CultureNameAndInfo;

            if (this.languageInitDone && cnai != null &&
                cnai.CultureInfo != PdnResources.Culture)
            {
                PdnResources.Culture = cnai.CultureInfo;
                LoadResources();
                this.pages.Clear();
                this.GoToPage(typeof(IntroPage));
            }
        }
示例#2
0
        protected override void OnLoad(EventArgs e)
        {
            // Setup default install dir
            string targetSubDir = PdnResources.GetString("SetupWizard.InstallDirPage.DefaultTargetSubDir");
            string programFilesDir = GetProgramFilesDir();
            string defaultTargetDir = Path.Combine(programFilesDir, targetSubDir);
            string targetDir = GetMsiProperty(PropertyNames.TargetDir, defaultTargetDir);

            // Set other default properties
            string jpgPngBmpEditor = GetMsiProperty(PropertyNames.JpgPngBmpEditor, "1");
            string tgaEditor = GetMsiProperty(PropertyNames.TgaEditor, "1");
            string checkForUpdates = GetMsiProperty(PropertyNames.CheckForUpdates, "1");
            string checkForBetas = GetMsiProperty(PropertyNames.CheckForBetas, PropertyNames.CheckForBetasDefault);

            if (!PdnInfo.IsFinalBuild)
            {
                checkForBetas = "1";
            }

            this.pdnBanner.BannerFont = this.HeadingTextFont;

            if (this.wizardPage == null || this.wizardPage.GetType() == typeof(IntroPage))
            {
                // Populate the language combo box
                string[] locales = PdnResources.GetInstalledLocales();
                CultureNameAndInfo[] cnais = new CultureNameAndInfo[locales.Length];

                for (int i = 0; i < locales.Length; ++i)
                {
                    string locale = locales[i];
                    CultureInfo ci = new CultureInfo(locale);
                    CultureNameAndInfo cnai = new CultureNameAndInfo(ci, GetCultureInfoName(ci));
                    cnais[i] = cnai;
                }

                Array.Sort(
                    cnais,
                    delegate(CultureNameAndInfo lhs, CultureNameAndInfo rhs)
                    {
                        return string.Compare(lhs.DisplayName, rhs.DisplayName,
                            StringComparison.InvariantCultureIgnoreCase);
                    });

                this.languageBox.DataSource = cnais;
                this.languageBox.DisplayMember = "DisplayName";

                // Choose the current locale

                // First find English
                CultureNameAndInfo englishCnai;

                englishCnai = Array.Find(
                    cnais,
                    delegate(CultureNameAndInfo cnai)
                    {
                        if (cnai.CultureInfo.Name.Length == 0 || cnai.CultureInfo.Name == "en-US")
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    });

                // Next, figure out what culture we're currently set to
                CultureNameAndInfo currentCnai;

                currentCnai = Array.Find(
                    cnais,
                    delegate(CultureNameAndInfo cnai)
                    {
                        return (cnai.CultureInfo == PdnResources.Culture);
                    });

                if (currentCnai == null)
                {
                    this.languageBox.SelectedItem = englishCnai;
                }
                else
                {
                    this.languageBox.SelectedItem = currentCnai;
                }

                this.languageInitDone = true;

                // Go to the appropriate page
                if (this.skipConfig)
                {
                    GoToPage(typeof(InstallingPage));
                }
                else
                {
                    GoToPage(typeof(IntroPage));
                }
            }

            base.OnLoad(e);
        }
示例#3
0
        protected override void OnLoad(EventArgs e)
        {
            // Setup default install dir
            string targetSubDir     = PdnResources.GetString("SetupWizard.InstallDirPage.DefaultTargetSubDir");
            string programFilesDir  = GetProgramFilesDir();
            string defaultTargetDir = Path.Combine(programFilesDir, targetSubDir);
            string targetDir        = GetMsiProperty(PropertyNames.TargetDir, defaultTargetDir);

            // Set other default properties
            string jpgPngBmpEditor = GetMsiProperty(PropertyNames.JpgPngBmpEditor, "1");
            string tgaEditor       = GetMsiProperty(PropertyNames.TgaEditor, "1");
            string checkForUpdates = GetMsiProperty(PropertyNames.CheckForUpdates, "1");
            string checkForBetas   = GetMsiProperty(PropertyNames.CheckForBetas, PropertyNames.CheckForBetasDefault);

            if (!PdnInfo.IsFinalBuild)
            {
                checkForBetas = "1";
            }

            this.pdnBanner.BannerFont = this.HeadingTextFont;

            if (this.wizardPage == null || this.wizardPage.GetType() == typeof(IntroPage))
            {
                // Populate the language combo box
                string[]             locales = PdnResources.GetInstalledLocales();
                CultureNameAndInfo[] cnais   = new CultureNameAndInfo[locales.Length];

                for (int i = 0; i < locales.Length; ++i)
                {
                    string             locale = locales[i];
                    CultureInfo        ci     = new CultureInfo(locale);
                    CultureNameAndInfo cnai   = new CultureNameAndInfo(ci, GetCultureInfoName(ci));
                    cnais[i] = cnai;
                }

                Array.Sort(
                    cnais,
                    delegate(CultureNameAndInfo lhs, CultureNameAndInfo rhs)
                {
                    return(string.Compare(lhs.DisplayName, rhs.DisplayName,
                                          StringComparison.InvariantCultureIgnoreCase));
                });

                this.languageBox.DataSource    = cnais;
                this.languageBox.DisplayMember = "DisplayName";

                // Choose the current locale

                // First find English
                CultureNameAndInfo englishCnai;

                englishCnai = Array.Find(
                    cnais,
                    delegate(CultureNameAndInfo cnai)
                {
                    if (cnai.CultureInfo.Name.Length == 0 || cnai.CultureInfo.Name == "en-US")
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                });

                // Next, figure out what culture we're currently set to
                CultureNameAndInfo currentCnai;

                currentCnai = Array.Find(
                    cnais,
                    delegate(CultureNameAndInfo cnai)
                {
                    return(cnai.CultureInfo == PdnResources.Culture);
                });

                if (currentCnai == null)
                {
                    this.languageBox.SelectedItem = englishCnai;
                }
                else
                {
                    this.languageBox.SelectedItem = currentCnai;
                }

                this.languageInitDone = true;

                // Go to the appropriate page
                if (this.skipConfig)
                {
                    GoToPage(typeof(InstallingPage));
                }
                else
                {
                    GoToPage(typeof(IntroPage));
                }
            }

            base.OnLoad(e);
        }