Пример #1
0
        public static MobileNavigationScreen Load(XDocument doc)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(MobileNavigationScreen));

            XmlReader reader = doc.CreateReader();

            reader.MoveToContent();

            MobileNavigationScreen screen = null;

            try
            {
                screen = (MobileNavigationScreen)serializer.Deserialize(reader);



                Configuration.GetInstance().MobileScreens.Add(screen);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Error occurred while processing Screen - {0}", doc.Root.FirstNode.ToString()), ex);
            }

            return(screen);
        }
Пример #2
0
        public static MobileScreen Load(string Name)
        {
            MobileScreen retVal = null;
            string       item   = String.Format("{0}.{1}.{2}.xml", ConfigurationLoader.ConfigAssemblyName, "MobileScreens", Name);

            using (Stream fileStream = ConfigurationLoader.ConfigAssembly.GetManifestResourceStream(item))
            {
                using (XmlReader xreader = XmlReader.Create(fileStream))
                {
                    XDocument doc      = XDocument.Load(xreader);
                    string    pageType = doc.Root.Element("Type").Value.ToLower();

                    switch (pageType)
                    {
                    case "mobilecontent":
                        retVal = MobileContentScreen.Load(doc);
                        break;

                    case "mobilenavigation":
                        retVal = MobileNavigationScreen.Load(doc);
                        break;

                    case "mobiletabbed":
                        retVal = MobileTabbedScreen.Load(doc);
                        break;

                    default:
                        retVal = MobileContentScreen.Load(doc);
                        break;
                    }
                }
            }

            return(retVal);
        }
Пример #3
0
        public static MobileNavigationScreen Load(string Name)
        {
            MobileNavigationScreen retVal = null;
            string item = String.Format("{0}.{1}.{2}.xml", ConfigurationLoader.ConfigAssemblyName, "MobileScreens", Name);

            using (Stream fileStream = ConfigurationLoader.ConfigAssembly.GetManifestResourceStream(item))
            {
                using (XmlReader xreader = XmlReader.Create(fileStream))
                {
                    XDocument doc = XDocument.Load(xreader);

                    retVal = Load(doc);
                }
            }

            return(retVal);
        }