Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            util = new Utility();
            mainJobList = new BindingList<IndeedDetails>();
            filtered = new List<IndeedDetails>();
            sortKeeper = new GridSortBy();
            //worker stuff
            worker = new BackgroundWorker();

            worker.DoWork += BackgroundWorkerDoWork;
            worker.RunWorkerCompleted +=
               BackgroundWorkerRunWorkerCompleted;

            string file_name = @"C:\Users\apersinger\Documents\Misc\jsonjobs.txt";
            string file_contents = util.OpenFile(file_name);
            if(file_contents.Length > 0) {
                data = util.DeserializeString(file_contents);
                mainJobList = new BindingList<IndeedDetails>(data);
                dataGridView1.DataSource = mainJobList;
            }

            txtURL.Text = "www.indeed.com";
            txtLocation.Text = "california";
            txtJobTitle.Text = "software";

            btnFilterResults.Enabled = false;
        }
Esempio n. 2
0
        public string GetResponse()
        {
            util = new Utility();
            // Get the original response.
            WebResponse response = request.GetResponse();

            this.Status = ((HttpWebResponse)response).StatusDescription;

            // Get the stream containing all content returned by the requested server.
            dataStream = response.GetResponseStream();

            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader(dataStream);

            // Read the content fully up to the end.
            string responseFromServer = reader.ReadToEnd();
            string retVal = util.ParseURL(this.url, responseFromServer);
            data = util.DeserializeString(retVal);
            responseFromServer = retVal;
            // Clean up the streams.
            reader.Close();
            dataStream.Close();
            response.Close();

            return responseFromServer;
        }
Esempio n. 3
0
        public string GetSpecificResponse(string url)
        {
            WebRequest new_request;
            WebResponse response;
            StreamReader reader;

            util = new Utility();
            if (url.IndexOf("www.") == 0)
            {
                url = "http://" + url;
            }
            try
            {
                new_request = WebRequest.Create(url);
                // Get the original response.
                response = new_request.GetResponse();

                this.Status = ((HttpWebResponse)response).StatusDescription;

                // Get the stream containing all content returned by the requested server.
                dataStream = response.GetResponseStream();

                // Open the stream using a StreamReader for easy access.
                reader = new StreamReader(dataStream);

                // Read the content fully up to the end.
                string responseFromServer = reader.ReadToEnd();
                // Clean up the streams.
                reader.Close();
                dataStream.Close();
                response.Close();
                return responseFromServer;

            }
            catch (System.Net.WebException exc)
            {
                return "EXCEPTION!!! " + exc.ToString();
            }
        }