Last active
April 7, 2016 11:48
-
-
Save brilvio/24fba5a3ac55a37f82c918974f110d1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace WindowsFormsApplication1 | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
var test = new Teste(); | |
//Result.Text = test.Somar(Int32.Parse(A.Text), Int32.Parse(B.Text)).ToString(); | |
List<Posto> teste = test.Rest(); | |
for (int i = 0; i < teste.Count - 1; i++) | |
{ | |
textBox1.AppendText(test.Rest()[i].nome + "\r\n"); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Android.App; | |
using Android.Content; | |
using Android.Runtime; | |
using Android.Views; | |
using Android.Widget; | |
using Android.OS; | |
using System.Collections.Generic; | |
namespace App6 | |
{ | |
[Activity(Label = "App6", MainLauncher = true, Icon = "@drawable/icon")] | |
public class MainActivity : Activity | |
{ | |
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
// Set our view from the "main" layout resource | |
SetContentView(Resource.Layout.Main); | |
// Get our button from the layout resource, | |
// and attach an event to it | |
Button button = FindViewById<Button>(Resource.Id.MyButton); | |
TextView testeRest = FindViewById<TextView>(Resource.Id.restTeste); | |
button.Click += delegate { | |
Teste teste = new Teste(); | |
List<Posto> test = teste.Rest(); | |
for (int i = 0; i < test.Count - 1; i++) | |
{ | |
testeRest.Text += test[i].nome + "\r\n"; | |
} | |
}; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using RestSharp; | |
using System; | |
using System.Collections.Generic; | |
public class Teste { | |
RestClient client; | |
public Teste() { | |
client = new RestClient("http://localhost:3000"); | |
} | |
public List<Posto> Rest() { | |
var request = new RestRequest("api/postos?access_token={access}",Method.GET); | |
request.AddUrlSegment("access", "ToJVSIOGTOFwQqx45HIDcQmAD9TRiDu1tDs3xZeZOob3T3VQwuPdvWAajDD8gQ3n"); | |
IRestResponse response = client.Execute(request); | |
var content = response.Content; | |
return JsonConvert.DeserializeObject<List<Posto>>(content); | |
} | |
} | |
public class Posto { | |
public string nome { get; set; } | |
public string cnpj { get; set; } | |
public string endereco { get; set; } | |
public string telefone { get; set; } | |
public int id { get; set; } | |
public int usuarioId { get; set; } | |
public int cidadeId { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍