예제 #1
0
        public void GerarPerimetrosGET(Token token)
        {
            try
            {
                if (token != null)
                {
                    this.Url = "https://mss-rj-378/RM.WebApplication/api/organization/perimeters";
                    WebRequest request = WebRequest.Create(Url);
                    request.Headers.Add("Authorization", "OAuth2 " + token.Access_token);

                    request.ContentLength = 0;
                    request.ContentType = "application/json";
                    request.Method = "GET";

                    WebResponse response = request.GetResponse();
                    Stream stream = response.GetResponseStream();
                    string jsonRead = readStream(stream);
                    string PathPerimetros = readJsonPerimetros(jsonRead);

                }
            }
            catch
            {
                throw;
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                // Carregamento barra status
                progressBar1.Value = 50;
                progressBar1.Update();
                ConfToken token = new ConfToken(url.Text, clienteid.Text, secretykey.Text);
                this.tokenGerado = token.GerarTokenPOST(token);
                // Carregamento barra status
                progressBar1.Value = 100;
                progressBar1.Update();

                MessageBox.Show("Token Gerado Com Sucesso!");

                progressBar1.Value = 0;
                progressBar1.Update();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #3
0
 public Token readJsonToken(string readResponseServer)
 {
     try
      {
          Token t = new Token();
          t = JsonConvert.DeserializeObject<Token>(readResponseServer);
          return t;
      }
      catch
      {
          throw;
      }
 }