コード例 #1
0
ファイル: Pod.cs プロジェクト: grdaneault/the-alpha
        public Pod(string title, ImageResult img)
        {
            img.Owner = this;
            _images = new List<ImageResult>();
            _images.Add(img);

            Title = title;

            RowSpan = CalcRowSpan(img.Height + 60);
            ColSpan = CalcColSpan(img.Width);

            _numSubpods = 1;
            _states = new List<State>();
        }
コード例 #2
0
ファイル: Info.cs プロジェクト: grdaneault/the-alpha
        public Info(XElement info)
        {
            XAttribute textAttr = info.Attribute("text");

            if (textAttr != null)
            {
                Text = textAttr.Value;
            }
            else
            {
                Text = "";
            }
            XElement img = info.Element("img");
            if (img != null)
            {
                Image = new ImageResult(img);
            }

            Links = new List<InfoLink>();
            foreach (XElement link in info.Elements("link"))
            {
                Links.Add(new InfoLink(link));
            }
        }
コード例 #3
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 + ") ";
        }
コード例 #4
0
 private static async System.Threading.Tasks.Task<bool> OpenImageInBrowser(ImageResult img)
 {
     return await OpenUriInBrowser(new Uri(img.URL));
 }
コード例 #5
0
ファイル: SearchResult.cs プロジェクト: grdaneault/the-alpha
        public void FillSample()
        {
            var podsRaw = new List<Pod>();

            var ad = new ImageResult("http://smallgroupproductions.com/wp-content/uploads/AdPlaceholder.png",
                                     292, 90);
            //ImageResult ad250 = new ImageResult("http://smallgroupproductions.com/wp-content/uploads/250x250_ad_placeholder.png", 250, 250);
            var input = new ImageResult("ms-appx:///Assets/5/input.gif", 8, 18);
            var numName = new ImageResult("ms-appx:///Assets/5/number name.gif", 23, 18);
            var visualRep = new ImageResult("ms-appx:///Assets/5/visual representation.gif", 62, 17);
            var numLine = new ImageResult("ms-appx:///Assets/5/number line.gif", 300, 55);
            var romanNumerals = new ImageResult("ms-appx:///Assets/5/roman numerals.gif", 10, 18);
            var binaryForm = new ImageResult("ms-appx:///Assets/5/binary form.gif", 31, 18);
            var primeFact = new ImageResult("ms-appx:///Assets/5/prime fact.gif", 137, 18);
            var residues = new ImageResult("ms-appx:///Assets/5/residues.gif", 314, 68);
            var prop1 = new ImageResult("ms-appx:///Assets/5/prop-1.gif", 131, 18);
            var prop2 = new ImageResult("ms-appx:///Assets/5/prop-2.gif", 296, 43);
            var prop3 = new ImageResult("ms-appx:///Assets/5/prop-3.gif", 271, 37);
            var prop4 = new ImageResult("ms-appx:///Assets/5/prop-4.gif", 412, 18);
            var quadResidue = new ImageResult("ms-appx:///Assets/5/quad-residue.gif", 500, 18);
            var primitiveRoots = new ImageResult("ms-appx:///Assets/5/primitive roots.gif", 500, 18);
            var charCodes = new ImageResult("ms-appx:///Assets/5/char codes.gif", 357, 89);
            var propList = new List<ImageResult>() {prop1, prop2, prop3, prop4};
            podsRaw.Add(new Pod("Input", ad));
            podsRaw.Add(new Pod("Number Name", numName));
            podsRaw.Add(new Pod("Visual Representation", visualRep));
            podsRaw.Add(new Pod("Number Line", numLine));
            podsRaw.Add(new Pod("Roman Numerals", romanNumerals));
            podsRaw.Add(new Pod("Binary Form", binaryForm));
            podsRaw.Add(new Pod("Prime Factorization", primeFact));
            podsRaw.Add(new Pod("Residues", residues));
            podsRaw.Add(new Pod("Properties", propList));
            podsRaw.Add(new Pod("Quadratic Residue", quadResidue));
            podsRaw.Add(new Pod("Primitive Roots", primitiveRoots));
            podsRaw.Add(new Pod("Character Codes", charCodes));
            Query = "5";

            /*
            ImageResult one = new ImageResult("ms-appx:///Assets/One.png", 292, 100);
            ImageResult two = new ImageResult("ms-appx:///Assets/Two.png", 292, 100);
            ImageResult three = new ImageResult("ms-appx:///Assets/Three.png", 292, 100);
            ImageResult four = new ImageResult("ms-appx:///Assets/Four.png", 292, 100);
            ImageResult five = new ImageResult("ms-appx:///Assets/Five.png", 200, 30);
            ImageResult six = new ImageResult("ms-appx:///Assets/Six.png", 200, 68);
            ImageResult seven = new ImageResult("ms-appx:///Assets/Seven.png", 400, 800);
            List<ImageResult> all = new List<ImageResult>() { six, one, two, three, four, five, six };
                
            Pod p1 = new Pod("One", all);
            Pod p2 = new Pod("Two", seven); 
            Pod p3 = new Pod("Three", all);
            Pod p4 = new Pod("Four", four);
            Pod p5 = new Pod("Five", all);
            Pod p6 = new Pod("Six", two);
            Pod p7 = new Pod("Seven", one);
            Pod p8 = new Pod("Eight", three);
            Pod p9 = new Pod("Nine", three);
            Pod p10 = new Pod("Ten", two);
            Pod p11 = new Pod("Eleven", four);
            Pod p12 = new Pod("Twelve", three);
            Pod p13 = new Pod("Thirteen", one);

            p1.ColSpan = 2;
            p4.ColSpan = 2;
            p5.ColSpan = 2;
            p5.RowSpan = 2;
            p10.ColSpan = 2;
            p10.RowSpan = 2;
            p11.ColSpan = 2;
            p11.RowSpan = 2;
            p12.ColSpan = 2;
            p13.ColSpan = 2;
            p13.RowSpan = 2;
                    
            podsRaw.Add(p1);
            podsRaw.Add(p2);
            podsRaw.Add(p3);
            podsRaw.Add(p4);
            podsRaw.Add(p5);
            podsRaw.Add(p6);
            podsRaw.Add(p7);
            podsRaw.Add(p8);
            podsRaw.Add(p9);
            podsRaw.Add(p10);
            podsRaw.Add(p11);
            podsRaw.Add(p12);
            podsRaw.Add(p13);
            */

            Pods = new PodCollection(podsRaw, NumRows);
            Assumptions = new List<Assumption>();
        }