コード例 #1
0
        private void tp_list_Enter(object sender, EventArgs e)
        {
            if (employment == null)
            {
                string jsonEmp = rj.getRESTDataJSON("/employment/");
                employment = JToken.Parse(jsonEmp).ToObject <Employment>();
            }
            //build the listView
            sw.Reset();
            sw.Start();
            //prepare the listView
            listView1.View          = View.Details;
            listView1.GridLines     = true;
            listView1.FullRowSelect = true;
            listView1.Width         = 710;
            //assign columns
            listView1.Columns.Add("Employer", 200);
            listView1.Columns.Add("Degree", 200);
            listView1.Columns.Add("City", 200);
            listView1.Columns.Add("Term", 200);

            //dump out the data...
            ListViewItem item;

            for (int i = 0; i < employment.coopTable.coopInformation.Count; i++)
            {
                item = new ListViewItem(new String[]
                {
                    employment.coopTable.coopInformation[i].employer,
                    employment.coopTable.coopInformation[i].degree,
                    employment.coopTable.coopInformation[i].city,
                    employment.coopTable.coopInformation[i].term
                });
                listView1.Items.Add(item);
            }
        }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Console.WriteLine("From Load");
            //go get /about/
            string jsonAbout = rj.getRESTDataJSON("/about/");

            //Console.WriteLine(jsonAbout);
            //cast it to the About object!
            about = JToken.Parse(jsonAbout).ToObject <About>();
            //access
            //Console.WriteLine(about.title);
            label4.Text = about.description;
            label1.Text = about.quote;
            label2.Text = (" -- -- " + about.quoteAuthor);
            label3.Text = about.title;
            Console.WriteLine(about.quoteAuthor);

            string jsonResources = rj.getRESTDataJSON("/resources/");

            resources = JToken.Parse(jsonResources).ToObject <Resources>();
            //populate the linkLabel with the RITJobZoneLink!


            string jsonEmp = rj.getRESTDataJSON("/employment/");

            employment = JToken.Parse(jsonEmp).ToObject <Employment>();

            string jsonMinors = rj.getRESTDataJSON("/minors/");

            minors = JToken.Parse(jsonMinors).ToObject <Minors>();

            string jsonFooter = rj.getRESTDataJSON("/footer/");

            footer = JToken.Parse(jsonFooter).ToObject <Footer>();

            string jsonPeople = rj.getRESTDataJSON("/people/");

            people = JToken.Parse(jsonPeople).ToObject <People>();

            string jsonDegrees = rj.getRESTDataJSON("/degrees/");

            degrees = JToken.Parse(jsonDegrees).ToObject <Degrees>();

            string jsonResearch = rj.getRESTDataJSON("/research/");

            research = JToken.Parse(jsonResearch).ToObject <Research>();

            string jsonNews = rj.getRESTDataJSON("/news/");

            news = JToken.Parse(jsonNews).ToObject <News>();

            linkLabel1.Text = footer.quickLinks[0].href;
            linkLabel2.Text = "http://ist.rit.edu/api/contactForm.php";
            linkLabel3.Text = footer.quickLinks[1].href;

            /*imageine that I have a bunch of tabs(like an admin) that the entire
             * application needs, but specific users don't - how do we handle that?
             *
             */

            //names of the tabs that I have access to

            //string[] names = { "People", "ListView", "DataGrid", "tabPage4" };

            //kill all athat I shouldn't have access to

            /*foreach (TabPage tab in tabControl1.TabPages) {
             *  if (names.Contains(tab.Text))
             *  {
             *      //kill it
             *      int t = tabControl1.TabPages.IndexOf(tab);
             *      tabControl1.TabPages.RemoveAt(t);
             *  }
             * }*/

            //how do I dynamically create one a new tab?

            //TabPage myNewTab = new TabPage("News");
            //tabControl1.TabPages.Add(myNewTab);

            //TextBox tb = new TextBox();
            //tb.BackColor = SystemColors.HotTrack;
            //tb.Location = new Point(10, 10);
            //tb.Size = new Size(180, 30);
            //tb.TabIndex = 1;
            //myNewTab.Controls.Add(tb);
        }