Esempio n. 1
0
        /// <summary>
        /// Loads modules to listview
        /// </summary>
        /// <param name="language"></param>
        public void loadModules(CLanguageInfo language)
        {
            List<Type> modules = new List<Type>();
            try
            {
                if (language.Value.Equals("empty"))
                {
                    modules.AddRange(CModuleReader.Instance.langToModulesMap[String.Empty]);
                }
                else
                {
                    modules.AddRange(CModuleReader.Instance.langToModulesMap[language.Value]);
                    modules.AddRange(CModuleReader.Instance.langToModulesMap[String.Empty]);
                }
            }
            catch (KeyNotFoundException)
            {
                CFormController.Instance.mainForm.setStatus("no WS modules found: ");
            }

            listView1.Groups.Clear();
            listView1.Items.Clear();
            foreach (Type moduleType in modules)
            {
                String groupName = moduleType.GetField("group").GetValue(null).ToString();
                listView1.Groups.Add(groupName, groupName);

                String moduleName = moduleType.GetField("name").GetValue(null).ToString();
                ListViewItem newItem = new ListViewItem(moduleName);
                newItem.Group = listView1.Groups[groupName];

                listView1.Items.Add(newItem);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates wrapper language class, tries to get info from 
        /// LanguageInfoHelper.settings
        /// </summary>
        /// <param name="langID"></param>
        /// <returns></returns>
        public static CLanguageInfo getLangItem(String langID)
        {
            CLanguageInfo item = new CLanguageInfo();

            // Set value
            item.Value = langID;

            // Try to set nice text
            try
            {
                item.Text = (String)LanguagesInfos.Default[langID];
            }
            catch (System.Configuration.SettingsPropertyNotFoundException)
            {
                item.Text = langID;
            }

            return item;
        }
Esempio n. 3
0
        /// <summary>
        /// Creates wrapper language class, tries to get info from
        /// LanguageInfoHelper.settings
        /// </summary>
        /// <param name="langID"></param>
        /// <returns></returns>
        public static CLanguageInfo getLangItem(String langID)
        {
            CLanguageInfo item = new CLanguageInfo();

            // Set value
            item.Value = langID;

            // Try to set nice text
            try
            {
                item.Text = (String)LanguagesInfos.Default[langID];
            }
            catch (System.Configuration.SettingsPropertyNotFoundException)
            {
                item.Text = langID;
            }

            return(item);
        }