예제 #1
0
파일: Pod.cs 프로젝트: grdaneault/the-alpha
        public Pod(XElement source, SearchResult searchResult)
        {
            Result = searchResult;
            _title = source.Attribute("title").Value;
            Scanner = source.Attribute("scanner").Value;
            Id = source.Attribute("id").Value;
            Position = int.Parse(source.Attribute("position").Value);
            Error = bool.Parse(source.Attribute("error").Value);

            _numSubpods = int.Parse(source.Attribute("numsubpods").Value);
            _images = new List<ImageResult>(_numSubpods);
            int maxHeight = 0, maxWidth = 0;
            foreach (XElement img in source.Elements("subpod"))
            {
                ImageResult i = new ImageResult(img);
                if (i.Height > maxHeight)
                {
                    maxHeight = i.Height;
                }
                if (i.Width > maxWidth)
                {
                    maxWidth = i.Width;
                }
                i.Owner = this;
                _images.Add(i);
            }

            XElement infos = source.Element("infos");
            if (infos != null)
            {
                _numInfos = int.Parse(infos.Attribute("count").Value);
                _infos = new List<Info>(_numInfos);
                foreach (XElement info in infos.Elements("info"))
                {
                    Info i = new Info(info);
                    _infos.Add(i);
                }
            }
            else
            {
                _infos = new List<Info>(0);
                _numInfos = 0;
            }

            XElement statesNode = source.Element("states");
            if (statesNode != null)
            {
                _numStates = int.Parse(statesNode.Attribute("count").Value);
                _states = new List<State>(_numStates);
                foreach (XElement state in statesNode.Elements("state"))
                {
                    _states.Add(new State(state));
                }
            }
            else
            {
                _states = new List<State>();
                _numStates = 0;
            }

            RowSpan = CalcRowSpan(maxHeight + 60);
            ColSpan = CalcColSpan(maxWidth);

            //_title += " (" + RowSpan + " x " + ColSpan + ") ";
        }
예제 #2
0
        private Menu createInfoMenu(Info info)
        {
            var menu = new Menu();

            foreach (var link in info.Links)
            {
                var mi = new MenuItem();
                mi.Tag = link.Uri;
                mi.Tapped += infoMI_tapped;
                mi.Text = link.Text;
                mi.MenuTextMargin = new Thickness(28, 10, 28, 12);
                menu.Items.Add(mi);
            }

            return menu;

        }