47 lines
1.7 KiB
VB.net
47 lines
1.7 KiB
VB.net
Imports System.IO
|
|
Imports DigitalData.Modules.Interfaces
|
|
Imports DigitalData.Modules.Logging
|
|
|
|
Public Class Form1
|
|
Private _LogConfig As LogConfig
|
|
Private _Interface As GraphQLInterface
|
|
|
|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
_LogConfig = New LogConfig(LogConfig.PathType.CurrentDirectory)
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Try
|
|
_Interface = New GraphQLInterface(_LogConfig,
|
|
txtBaseUrl.Text,
|
|
txtUsername.Text,
|
|
txtPassword.Text,
|
|
txtCertFile.Text,
|
|
txtCertPass.Text)
|
|
|
|
Dim oLoginResponse = _Interface.Login()
|
|
_Interface.SaveCookies(oLoginResponse.Cookies.Item(0))
|
|
|
|
Dim oDataResponse = _Interface.GetData(txtQuery.Text, "Nls")
|
|
Dim oResult As String
|
|
|
|
Using oStream = oDataResponse.GetResponseStream()
|
|
Using oReader As New StreamReader(oStream)
|
|
oResult = oReader.ReadToEnd()
|
|
End Using
|
|
End Using
|
|
|
|
File.WriteAllText("E:\JenneJ\WISAG\results.json", oResult)
|
|
|
|
Dim oObj = Newtonsoft.Json.JsonConvert.DeserializeObject(oResult)
|
|
Dim oJson = Newtonsoft.Json.JsonConvert.SerializeObject(oObj, Newtonsoft.Json.Formatting.Indented)
|
|
|
|
txtResults.Text = oJson
|
|
|
|
Dim oLogoutResponse = _Interface.Logout()
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
End Class
|