Пример #1
0
        private static Type[] GetExtraTypes()
        {
            var sectionTypes = SectionType.GetTypeArray();
            var widgetTypes  = ControlType.GetTypeArray();

            var combinedTypes = sectionTypes.Concat(widgetTypes).ToArray();

            return(combinedTypes);
        }
Пример #2
0
        public static void Save(SectionType item)
        {
            string ConfigPath = ConfigurationLoader.GetFileConfigurationPath();


            string filePath = String.Format("{0}SectionTypes\\{1}.xml", ConfigPath, item.Name);

            ConfigurationLoader.SerializeObjectToFile(item, filePath);
        }
Пример #3
0
        public static Section GetNewSection(string type)
        {
            SectionType sectionType           = SectionType.GetByName(type);
            string      assemblyQualifiedName = String.Format("{0}, {1}", sectionType.AbstractionClass, sectionType.AbstractionAssembly);

            Type    t      = System.Type.GetType(assemblyQualifiedName, false, true);
            Section retval = (Section)Activator.CreateInstance(t);

            return(retval);
        }
Пример #4
0
        public static SectionType GetByName(string Name)
        {
            SectionType item = Configuration.GetInstance().SectionTypes
                               .Where(i =>
                                      (
                                          (i.Name.ToLower() == Name.ToLower())
                                      )
                                      )
                               .SingleOrDefault();

            return(item);
        }
Пример #5
0
        public static SectionType GetSectionType(Section item)
        {
            SectionType sectionType = Configuration.GetInstance().SectionTypes
                                      .Where(s =>
                                             (
                                                 (s.Name.ToLower() == item.Type.ToLower())
                                             )
                                             )
                                      .SingleOrDefault();

            return(sectionType);
        }
Пример #6
0
        public static void Load(XDocument doc)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SectionType));
            XmlReader     reader     = doc.CreateReader();

            reader.MoveToContent();

            SectionType item = null;

            try
            {
                item = (SectionType)serializer.Deserialize(reader);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("Error occurred while processing SectionType", doc.Root.FirstNode.ToString()), ex);
            }

            Configuration.GetInstance().SectionTypes.Add(item);
        }