Example #1
0
        //Calls the api to perform the http request for the information
        private void performQuery_Click(object sender, EventArgs e)
        {
            //validate the query here
            if (ValidateQueryFields())
            {
                openShpeForm.setStatus("Requesting information from server");
                openShpeAPI = new OpenShpe("openshpe.staging.shpe.org", "b4FYkwOxPktPGbDUiw2S", "OImgt?5oin[a<T_Qo71SD*IKiG39MFNP*JPADAHK", true);
                openShpeAPI.SetHttpMethod(GetMethod());
                Stream result = null;
                try
                {
                    result = openShpeAPI.GetRestResponse(GetServicePath(), GetParameters());
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                if (result != null)
                {
                    openShpeForm.setStatus("Populating Grid. This may take a moment!");
                    //Must use string builder these results can be very long
                    StreamReader  reader = new StreamReader(result);
                    StringBuilder sb     = new StringBuilder();
                    sb.Append(reader.ReadToEnd());

                    DataSet      dataSet      = new DataSet();
                    StringReader stringReader = new StringReader(sb.ToString());
                    File.WriteAllText("XmlDump.xml", sb.ToString());
                    XmlToDataSet xds = new XmlToDataSet("XmlDump.xml");
                    dataSet = xds.Convert();
                    openShpeForm.FillDataGrid(dataSet);
                }
            }
        }
Example #2
0
        //Calls the api to perform the http request for the information
        private void performQuery_Click(object sender, EventArgs e)
        {
            //validate the query here
            if (ValidateQueryFields())
            {
                openShpeForm.setStatus("Requesting information from server");
                openShpeAPI = new OpenShpe("openshpe.staging.shpe.org", "b4FYkwOxPktPGbDUiw2S", "OImgt?5oin[a<T_Qo71SD*IKiG39MFNP*JPADAHK", true);
                openShpeAPI.SetHttpMethod(GetMethod());
                Stream result = null;
                try
                {
                    result = openShpeAPI.GetRestResponse(GetServicePath(), GetParameters());
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                if (result != null)
                {
                    openShpeForm.setStatus("Populating Grid. This may take a moment!");
                    //Must use string builder these results can be very long
                    StreamReader reader = new StreamReader(result);
                    StringBuilder sb = new StringBuilder();
                    sb.Append(reader.ReadToEnd());

                    DataSet dataSet = new DataSet();
                    StringReader stringReader = new StringReader(sb.ToString());
                    File.WriteAllText("XmlDump.xml", sb.ToString());
                    XmlToDataSet xds = new XmlToDataSet("XmlDump.xml");
                    dataSet = xds.Convert();
                    openShpeForm.FillDataGrid(dataSet);

                }
            }
        }