Exemplo n.º 1
0
 private void UpdateCodeDomProviders(bool must)
 {
     if (must || ls.Count == 0)
     {
         if (CodeProviderRouter == null)
         {
             CodeProviderRouter = new LangCodeProvider();
             CodeProviderRouter.OtherProvider = new List <string>();
         }
         ls = GetProviderList(CodeProviderRouter.OtherProvider.ToArray());
         foreach (var item in Enum.GetNames(typeof(cfLangType)))
         {
             ProviderInfo pi = typeof(LangCodeProvider).InvokeMember(item, BindingFlags.GetProperty, null, Kit.GetDefaultCodeProviderRouter(), new object[] { }) as ProviderInfo;
             if (!Exists(pi))
             {
                 ls.Add(pi);
             }
         }
     }
     foreach (var item in Enum.GetNames(typeof(cfLangType)))
     {
         if (this.Controls.ContainsKey("cbx" + item))
         {
             cbxCodeDomeProvider cbx = this.Controls["cbx" + item] as cbxCodeDomeProvider;
             if (cbx != null)
             {
                 cbx.UpdateCodeDomProvider(ls);
             }
         }
     }
 }
Exemplo n.º 2
0
 private void ReloadRouterInfo()
 {
     foreach (var item in Enum.GetNames(typeof(cfLangType)))
     {
         if (this.Controls.ContainsKey("cbx" + item))
         {
             cbxCodeDomeProvider cbx = this.Controls["cbx" + item] as cbxCodeDomeProvider;
             if (cbx != null)
             {
                 cbx.ProviderInfo = typeof(LangCodeProvider).InvokeMember(item, BindingFlags.GetProperty, null, CodeProviderRouter, new object[] { }) as ProviderInfo;
                 Application.DoEvents();
             }
             Application.DoEvents();
         }
     }
 }
Exemplo n.º 3
0
        private void cbxCodeDomeProvider_SelectedCodeDomProvider(object sender, EventArgs e)
        {
            try
            {
                Application.DoEvents();
                cbxCodeDomeProvider cbx = sender as cbxCodeDomeProvider;

                if (CodeProviderRouter == null)
                {
                    ResetRouterInfo();
                }
                typeof(LangCodeProvider).InvokeMember(cbx.Name.Substring(3), BindingFlags.SetProperty, null, CodeProviderRouter, new object[] { cbx.ProviderInfo });
            }
            catch (Exception ex)
            {
                Common.ShowInfo("尝试更改CodeDomProvider时遇到问题" + ex.Message);
            }
        }