Beispiel #1
0
        //Get Subjects Button Click Event
        protected void Button3_Click(object sender, EventArgs e)
        {
            //Checking to see if the "no" radio button is checked
            if (noRadionButton.Checked)
            {
                //string[] requestArr = new string[5];
                //Calling static
                //Static method that returns results with no subjects requested
                MediaGetter.GetSiteContent(sitePath);
                //Method that gets five random subject photo contentURl and thumnbnailURLs
                string[] jsonC = MediaGetter.MakeRequest(MediaGetter.headerArray);

                imageInfoList = MediaGetter.GetRawUrls(jsonC);
                //Assignment of first image Url to first slider image
                panelImage[0] = imageInfoList[0].contentUrl;
                //Assignment of second image Url to second slider image
                panelImage[1] = imageInfoList[1].contentUrl;
                //Assignment of third image Url to third slider image
                panelImage[2] = imageInfoList[2].contentUrl;
                //Assignment of fourth image Url to fourth slider image
                panelImage[3] = imageInfoList[3].contentUrl;
                //Assignment of fifth image Url to fifth slider image
                panelImage[4] = imageInfoList[4].contentUrl;
            }
            //Checking to see if the "yes" radio button is checked
            else if (yesRadioButton.Checked)
            {
                //Conversion and assignment of total subjects user wants returned
                subjectNum = Convert.ToInt32(subjectNumberBox.Text);
                //call to overloaded method that returns number of subjects user specified
                string [] subjects = MediaGetter.GetSiteContent(sitePath, subjectNum);
                //Instatiation of datatable for subjects to be displayed in
                DataTable dataTable = new DataTable();
                //Creation of Columns for Datatable
                dataTable.Columns.Add("Subjects");
                //Call to AddListItem method
                AddListItem(dataTable, subjects);
                //Binding of the datatable as a data source for the listbox
                subjectListBox.DataSource = dataTable;
                //Binding the "Subjects" column to listbox field
                subjectListBox.DataTextField = "Subjects";
                //Final Bind
                subjectListBox.DataBind();
            }
        }
Beispiel #2
0
        //Click event for Select Photobutton IF USER SELECTS 'YES'
        protected void photoButton_Click(object sender, EventArgs e)
        {
            //iterator for listbox
            int t = 0;
            //Iterator for selected subject
            int p = 0;

            //For loop to evaluate and add selected items
            for (int i = 0; i < subjectListBox.Items.Count; i++)
            {
                //Evaluating if item is selected
                if (subjectListBox.Items[t].Selected)
                {
                    //If selected, add item value to string string array
                    selectedSubject[p] = subjectListBox.Items[t].ToString();
                    t++;
                    p++;
                }
                //Continue going through Listbox if the item is not selected
                else if (!subjectListBox.Items[t].Selected)
                {
                    t++;
                }
            }
            //Call to method that queries Bing Images API, and stores contentURL and thumbnailURl in string array
            string[] jsonC = MediaGetter.MakeRequest(selectedSubject);
            //call to method that parses JSON data and stores in a List of ImageContent
            imageInfoList = MediaGetter.GetRawUrls(jsonC);
            //Assignment of first image Url to first slider image
            panelImage[0] = imageInfoList[0].contentUrl;
            //Assignment of second image Url to second slider image
            panelImage[1] = imageInfoList[1].contentUrl;
            //Assignment of third image Url to third slider image
            panelImage[2] = imageInfoList[2].contentUrl;
            //Assignment of fourth image Url to fourth slider image
            panelImage[3] = imageInfoList[3].contentUrl;
            //Assignment of fifth image Url to fifth slider image
            panelImage[4] = imageInfoList[4].contentUrl;
        }