Esempio n. 1
0
 public static int Main(string[] Arguments)
 {
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(POLUtils.KaBOOM);
     Application.EnableVisualStyles();
     if (POL.AvailableRegions == POL.Region.None)
     {
         MessageBox.Show(I18N.GetText("Text:NoPOL"), I18N.GetText("Caption:NoPOL"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
     else
     {
         POLUtils.AvailableCultures = new ArrayList();
         string LastCulture = String.Empty;
         using (RegistryKey SettingsKey = POL.OpenPOLUtilsConfigKey())
         {
             if (SettingsKey != null)
             {
                 LastCulture = SettingsKey.GetValue("UI Culture", null) as string;
                 if (LastCulture == null)
                 {
                     LastCulture = String.Empty;
                 }
             }
         }
         // Detect Available Languages
         POLUtils.AvailableCultures.Add(new CultureChoice(CultureInfo.InvariantCulture));
         foreach (CultureInfo CI in CultureInfo.GetCultures(CultureTypes.AllCultures))
         {
             if (CI.Name != String.Empty && Directory.Exists(Path.Combine(Application.StartupPath, CI.Name)))
             {
                 CultureChoice CC = new CultureChoice(CI);
                 POLUtils.AvailableCultures.Add(CC);
                 if (LastCulture != String.Empty && LastCulture == CC.Culture.Name)
                 {
                     CultureChoice.Current = CC;
                 }
             }
         }
         if (CultureChoice.Current == null) // if none configured, default to invariant culture
         {
             CultureChoice.Current = POLUtils.AvailableCultures[0] as CultureChoice;
         }
         // The loop is for the benefit of language change
         POLUtils.KeepGoing = true;
         while (POLUtils.KeepGoing)
         {
             POLUtils.KeepGoing = false;
             Application.Run(new POLUtilsUI());
         }
     }
     return 0;
 }
Esempio n. 2
0
 public static int Main(string[] Arguments)
 {
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(POLUtils.KaBOOM);
     Application.EnableVisualStyles();
     if (POL.AvailableRegions == POL.Region.None)
     {
         MessageBox.Show(I18N.GetText("Text:NoPOL"), I18N.GetText("Caption:NoPOL"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
     else
     {
         POLUtils.AvailableCultures = new ArrayList();
         string LastCulture = String.Empty;
         using (RegistryKey SettingsKey = POL.OpenPOLUtilsConfigKey())
         {
             if (SettingsKey != null)
             {
                 LastCulture = SettingsKey.GetValue("UI Culture", null) as string;
                 if (LastCulture == null)
                 {
                     LastCulture = String.Empty;
                 }
             }
         }
         // Detect Available Languages
         POLUtils.AvailableCultures.Add(new CultureChoice(CultureInfo.InvariantCulture));
         foreach (CultureInfo CI in CultureInfo.GetCultures(CultureTypes.AllCultures))
         {
             if (CI.Name != String.Empty && Directory.Exists(Path.Combine(Application.StartupPath, CI.Name)))
             {
                 CultureChoice CC = new CultureChoice(CI);
                 POLUtils.AvailableCultures.Add(CC);
                 if (LastCulture != String.Empty && LastCulture == CC.Culture.Name)
                 {
                     CultureChoice.Current = CC;
                 }
             }
         }
         if (CultureChoice.Current == null) // if none configured, default to invariant culture
         {
             CultureChoice.Current = POLUtils.AvailableCultures[0] as CultureChoice;
         }
         // The loop is for the benefit of language change
         POLUtils.KeepGoing = true;
         while (POLUtils.KeepGoing)
         {
             POLUtils.KeepGoing = false;
             Application.Run(new POLUtilsUI());
         }
     }
     return(0);
 }
Esempio n. 3
0
        private void cmbCultures_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (!this.Visible || this.cmbCultures.SelectedItem == null)
            {
                return;
            }
            CultureChoice CC = this.cmbCultures.SelectedItem as CultureChoice;

            if (CC != null && CC.Name != CultureChoice.Current.Name)
            {
                CultureChoice.Current = CC;
                // Need to close and reopen the form to activate the changes
                POLUtils.KeepGoing = true;
                this.Close();
            }
        }