mercredi 30 avril 2014

Conversion of console app code to Windows Form code in VB


Vote count:

0




every one. I humbly want to ask for your support on this. I am doing my best trying to learn the Google Drive SDK and have followed all the steps provided in the video as well as on the page: http://ift.tt/1c2jasq


I have however come to halt as I realize the sample code provided is CSharp and no VB version. I've tried converting it to VB using the Telerik converter but the results are not encouraging as I still see curly brackets in there and what not. I know I see those,because its a console App and I will be sincere that Im not quite good at console app code.


I therefore humbly seek assistance on how to convert this already converted C# to VB code to a Windows Form version. Thank you.



Namespace GoogleDriveSamples
Class DriveCommandLineSample
Private Shared Sub Main(args As String())
Dim credential As UserCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(New ClientSecrets() With { _
Key .ClientId = "CLIENT_ID_HERE", _
Key .ClientSecret = "CLIENT_SECRET_HERE" _
}, New () {DriveService.Scope.Drive}, "user", CancellationToken.None).Result

' Create the service.
Dim service = New DriveService(New BaseClientService.Initializer() With { _
Key .HttpClientInitializer = credential, _
Key .ApplicationName = "Drive API Sample" _
})

Dim body As New File()
body.Title = "My document"
body.Description = "A test document"
body.MimeType = "text/plain"

Dim byteArray As Byte() = System.IO.File.ReadAllBytes("document.txt")
Dim stream As New System.IO.MemoryStream(byteArray)

Dim request As FilesResource.InsertMediaUpload = service.Files.Insert(body, stream, "text/plain")
request.Upload()

Dim file As File = request.ResponseBody
Console.WriteLine("File id: " + file.Id)
Console.WriteLine("Press Enter to end this process.")
Console.ReadLine()
End Sub
End Class
End Namespace


asked 19 secs ago






Aucun commentaire:

Enregistrer un commentaire