-
Notifications
You must be signed in to change notification settings - Fork 0
code simple
loudKode edited this page May 13, 2019
·
2 revisions
Dim TOKN = Await ImageshackSDK.Get_Token.GET_AuthToken(T_Username.Text, T_Password.Text, _proxi:=Proxies) Dim Proxies As New ImageshackSDK.ProxyConfig With {.SetProxi = False, .ProxiIP = "103.105.48.16", .ProxiPort = "80"}
Dim cLNT As ImageshackSDK.IClient = New ImageshackSDK.HClient("xxxxxxxdd2b419260163ea7c", Proxies) If T_TOKN.Text Is String.Empty Then MsgBox("get token first.", MsgBoxStyle.Exclamation, "no token!!") : Return
Dim frm As New DeQma.FileFolderDialogs.VistaOpenFileDialog With {.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.gif;*.webp;*.bmp;", .Multiselect = False, .Title = "Select image/s to upload"}
If frm.ShowDialog = DialogResult.OK Then
If Not frm Is String.Empty Then
Dim UploadCancellationToken As New Threading.CancellationTokenSource()
Dim progressIndicator_ReportCls As Progress(Of ImageshackSDK.ReportStatus) = New Progress(Of ImageshackSDK.ReportStatus)(Sub(ReportClass As ImageshackSDK.ReportStatus)
Label1.Text = String.Format("{0}/{1}", ISisFunctions.Bytes_To_KbMbGb.SetBytes(ReportClass.BytesTransferred), ISisFunctions.Bytes_To_KbMbGb.SetBytes(ReportClass.TotalBytes))
ProgressBar1.Value = CInt(ReportClass.ProgressPercentage)
Label2.Text = If(CStr(ReportClass.TextStatus) Is Nothing, "Uploading...", CStr(ReportClass.TextStatus))
End Sub)
Dim UPconf As New ImageshackSDK.HClient.UploadImageConfig
UPconf.TheImgFile = frm.FileName
UPconf.TheImgName = IO.Path.GetFileName(frm.FileName)
UPconf.AlbumTitleOrAlbumID = T_AlbumTitleOrAlbumID.Text
'UPconf.Descriptions = New List(Of String) From {"Descriptions001", "Descriptio002", "Descri003"}
'UPconf.Tags = New List(Of String) From {"Tags001", "Tags002", "Tags003"}
'UPconf.CommentsDisabled = True
Dim rslt = Await cLNT.UploadLocal(UPconf, ImageshackSDK.HClient.SentType.file, progressIndicator_ReportCls, Proxies, UploadCancellationToken.Token)
RichTextBox1.Text = rslt.JSON.ToString
Dim row_file As String() = New String() {rslt.result.images(0).filename, rslt.result.images(0).direct_link}
DataGridView1.Rows.Add(row_file)
End If
End If Dim RSLT = Await cLNT.UserUsage(T_Username.Text)Dim RSLT = Await cLNT.ListAllImages(T_Username.Text, False, True, True, False, 12, 1) Dim RSLT = Await cLNT.ListAllAlbums(T_Username.Text, 20, True, False, False, 20, 0)Dim RSLT = Await cLNT.CreateAlbum(T_AlbumName.Text, Nothing, True, Nothing)