예제 #1
0
        protected override void HandleChild(ParseResult result, XElement child, string baseUri, bool addImageQuery)
        {
            switch (child.Name.LocalName.ToLower())
            {
            case "text":

                TileTextField text = new TileTextField();
                text.Parse(result, child);

                if (!result.IsOkForRender())
                {
                    throw new IncompleteElementException();
                }

                if (text != null)
                {
                    this.Add(text);
                }

                break;



            case "image":

                TileImage image = new TileImage();
                image.Parse(result, child, baseUri, addImageQuery);

                if (!result.IsOkForRender())
                {
                    throw new IncompleteElementException();
                }

                if (image != null)
                {
                    this.Add(image);
                }

                break;



            default:
                result.AddWarning($"Invalid child \"{child.Name.LocalName}\" under subgroup element. It will be ignored.", GetErrorPositionInfo(child));
                break;
            }
        }
예제 #2
0
        protected override void HandleChild(ParseResult result, XElement child, string baseUri, bool addImageQuery)
        {
            switch (child.Name.LocalName.ToLower())
            {
            case "text":

                TileTextField text = new TileTextField();
                text.Parse(result, child);

                if (!result.IsOkForRender())
                {
                    return;
                }

                this.Add(text);

                break;



            case "image":

                TileImage image = new TileImage();
                image.Parse(result, child, baseUri, addImageQuery);

                if (!result.IsOkForRender())
                {
                    return;
                }

                switch (image.Placement)
                {
                case Placement.Peek:

                    if (this.PeekImage != null)
                    {
                        result.AddWarning("Multiple peek images were supplied inside a binding. Only the first will be used.", GetErrorPositionInfo(child));
                    }
                    else
                    {
                        this.PeekImage = image;
                    }

                    break;



                case Placement.Background:
                    if (this.BackgroundImage != null)
                    {
                        result.AddWarning("Multiple background images were supplied inside a binding. Only the first will be used.", GetErrorPositionInfo(child));
                    }
                    else
                    {
                        this.BackgroundImage = image;
                    }
                    break;


                default:
                    Add(image);
                    break;
                }

                break;



            case "group":

                TileGroup group = new TileGroup();
                group.Parse(result, child, baseUri, addImageQuery);

                if (!result.IsOkForRender())
                {
                    return;
                }

                if (group != null)
                {
                    this.Add(group);
                }

                break;



            default:
                result.AddWarning($"Invalid child \"{child.Name.LocalName}\" under binding element. It will be ignored.", GetErrorPositionInfo(child));
                break;
            }
        }