示例#1
0
        private void Populate()
        {
            //populates the labels at he about information
            string jsonAbout = rt.GET("/about/");
            //Console.WriteLine(jsonAbout);
            //convert to object
            About about = JToken.Parse(jsonAbout).ToObject <About>();

            lblTitle.Text  = about.title;
            lblQuote.Text  = about.quote;
            lblAuthor.Text = about.quoteAuthor;

            //only populates the degrees first and the undergrad info
            // after as it enters it will populate

            jsonDegrees = rt.GET("/degrees/");
            degrees     = JToken.Parse(jsonDegrees).ToObject <Degrees>();
            Console.WriteLine(degrees);
            //parts.Find(x => x.PartName.Contains("seat")));
            //WMC info
            Undergraduate wmc = degrees.undergraduate.Find(x => x.degreeName.Contains("wmc"));

            lblWMCTitle.Text = wmc.title;
            lblWMCDesc.Text  = wmc.description;

            ListViewItem item;

            for (int i = 0; i < wmc.concentrations.Count; i++)
            {
                item = new ListViewItem(new String[] { wmc.concentrations[i] });
                lvWMC.Items.Add(item);
            }

            //CIT info
            Undergraduate cit = degrees.undergraduate.Find(x => x.degreeName.Contains("cit"));

            lblCITTitle.Text = cit.title;
            lblCITDesc.Text  = cit.description;

            for (int i = 0; i < cit.concentrations.Count; i++)
            {
                item = new ListViewItem(new String[] { cit.concentrations[i] });
                lvCIT.Items.Add(item);
            }

            //HCI info
            Undergraduate hcc = degrees.undergraduate.Find(x => x.degreeName.Contains("hcc"));

            lblHCCTitle.Text = hcc.title;
            lblHCCDesc.Text  = hcc.description;

            for (int i = 0; i < hcc.concentrations.Count; i++)
            {
                item = new ListViewItem(new String[] { hcc.concentrations[i] });
                lvHCC.Items.Add(item);
            }
        }