コード例 #1
0
        public static void Save(ScreenType item)
        {
            string ConfigPath = ConfigurationLoader.GetFileConfigurationPath();


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

            ConfigurationLoader.SerializeObjectToFile(item, filePath);
        }
コード例 #2
0
        public static ScreenType GetByName(string Name)
        {
            ScreenType item = Configuration.GetInstance().ScreenTypes
                              .Where(i =>
                                     (
                                         (i.Name.ToLower() == Name.ToLower())
                                     )
                                     )
                              .SingleOrDefault();

            return(item);
        }
コード例 #3
0
        public static ScreenType GetScreenType(Screen screen)
        {
            ScreenType screenType = Configuration.GetInstance().ScreenTypes
                                    .Where(s =>
                                           (
                                               (s.Name.ToLower() == screen.Type.ToLower())
                                           )
                                           )
                                    .SingleOrDefault();

            return(screenType);
        }
コード例 #4
0
        public static void Load(System.Xml.Linq.XDocument doc)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ScreenType));
            XmlReader     reader     = doc.CreateReader();

            reader.MoveToContent();

            ScreenType item = null;

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

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