Beispiel #1
0
        public static MenuItem ReadFromXml(XmlReader reader, int CurrentLevel, int CurrentIndex)
        {
            MenuItem item = null;

            if (true == reader.MoveToFirstAttribute())
            {
                if (reader.Name == "Type")
                {
                    switch (reader.Value)
                    {
                    case "Menu":
                    {
                        item = new TileMenu();
                        break;
                    }

                    case "Article":
                    {
                        item = new TileArticle();
                        break;
                    }

                    case "MenuPage":
                    {
                        item = new TilePageMenu();
                        break;
                    }

                    case "ArticlePage":
                    {
                        item = new TilePageMenu();
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                    reader.MoveToNextAttribute();
                    item.FromXml(reader, CurrentLevel, CurrentIndex);
                }

                reader.MoveToElement();
            }

            return(item);
        }
        public static MenuItem ReadFromXml(XmlReader reader, int CurrentLevel, int CurrentIndex)
        {
            MenuItem item = null;

            if (true == reader.MoveToFirstAttribute())
            {
                if (reader.Name == "Type")
                {
                    switch (reader.Value)
                    {
                    case "Menu":
                    {
                        item = new TileMenu();
                        break;
                    }

                    case "Article":
                    {
                        item = new TileArticle();
                        break;
                    }        //TilePage

                    case "TilePage":
                    {
                        item = new TilePage();
                        break;
                    }

                    //case "MenuPage":
                    //    {
                    //        item = new TilePageMenu();
                    //        break;
                    //    }
                    //case "ArticlePage":
                    //    {
                    //        item = new TilePageMenu();
                    //        break;
                    //    }
                    case "TileClickableImage":
                    {
                        item = new TileClickableImage();
                        break;
                    }

                    case "TileScrollUI":
                    {
                        item = new TileScrollUI();
                        break;
                    }

                    case "TileScrollUI_LR":
                    {
                        item = new TileScrollUI_LR();
                        break;
                    }

                    default:
                    {
                        MessageBox.Show("ReadFromXml: no type");
                        break;
                    }
                    }
                    reader.MoveToNextAttribute();
                    item.FromXml(reader, CurrentLevel, CurrentIndex);
                }

                reader.MoveToElement();
            }

            return(item);
        }