导入Newtonsoft.Json.Linq
Public NotInheritable Class MainPage
Inherits Page
Public result As String = ""
Public Sub Btn_Test_Click(sender As Object, e As RoutedEventArgs) Handles Btn_Test.Click
getRequest("http://192.168.1.242/control?callback=cname&cmd=get_state_sensor&number=1")
Dim s As String = result
TBox1.Text = result
End Sub
Public Async Sub getRequest(uri As String)
Dim httpClient As New System.Net.Http.HttpClient
Dim response As System.Net.Http.HttpResponseMessage = Await httpClient.GetAsync(uri)
result = Await response.Content.ReadAsStringAsync()
End Sub
结束班