Public Class PictureService
Private tw As Twitter
- Public Function Upload(ByVal filePath As String, ByRef message As String, ByVal service As String) As String
+ Public Function Upload(ByRef filePath As String, ByRef message As String, ByVal service As String) As String
Dim file As New FileInfo(filePath)
If Not file.Exists Then Return "Err:File isn't exists."
Dim st As Setting = Setting.Instance
+ Dim ret As String = ""
+ Dim upResult As Boolean = False
Select Case service
Case "TwitPic"
- Return UpToTwitPic(file, message)
+ ret = UpToTwitPic(file, message, upResult)
Case "TwitVideo"
- Return UpToTwitVideo(file, message)
+ ret = UpToTwitVideo(file, message, upResult)
End Select
- Return ""
+ If upResult Then filePath = ""
+ Return ret
End Function
- Private Function UpToTwitPic(ByVal file As FileInfo, ByRef message As String) As String
+ Private Function UpToTwitPic(ByVal file As FileInfo, ByRef message As String, ByVal resultUpload As Boolean) As String
Dim content As String = ""
Dim ret As HttpStatusCode
'TwitPicへの投稿
Else
Return "Err:" + ret.ToString
End If
+ 'アップロードまでは成功
+ resultUpload = True
'Twitterへの投稿
'投稿メッセージの再構成
If message.Length + url.Length + 1 > 140 Then
Return tw.PostStatus(message, 0)
End Function
- Private Function UpToTwitVideo(ByVal file As FileInfo, ByRef message As String) As String
+ Private Function UpToTwitVideo(ByVal file As FileInfo, ByRef message As String, ByVal resultUpload As Boolean) As String
Dim content As String = ""
Dim ret As HttpStatusCode
'TwitVideoへの投稿
Else
Return "Err:" + ret.ToString
End If
+ 'アップロードまでは成功
+ resultUpload = True
'Twitterへの投稿
'投稿メッセージの再構成
If message.Length + url.Length + 1 > 140 Then
Public ids As List(Of Long) 'Fav追加・削除時のItemIndex
Public sIds As List(Of Long) 'Fav追加・削除成功分のItemIndex
Public tName As String = "" 'Fav追加・削除時のタブ名
- Public imageService As String = "" '画像投稿サービス名
- Public imagePath As String = ""
End Class
'検索処理タイプ
Public status As String = ""
Public inReplyToId As Long = 0
Public inReplyToName As String = ""
+ Public imageService As String = "" '画像投稿サービス名
+ Public imagePath As String = ""
End Class
Private Class SpaceKeyCanceler
Outputz.OutUrl = "http://twitter.com/" + tw.Username
End Select
+ '画像投稿サービス
+ SetImageServiceCombo()
+
'ウィンドウ設定
Me.ClientSize = _cfgLocal.FormSize
_mySize = _cfgLocal.FormSize 'サイズ保持(最小化・最大化されたまま終了した場合の対応用)
TimelinePanel.Visible = True
Exit Sub
End If
- args.imageService = ImageServiceCombo.Text
- args.imagePath = ImagefilePathText.Text
+ args.status.imageService = ImageServiceCombo.Text
+ args.status.imagePath = ImagefilePathText.Text
ImageSelectedPicture.Image = ImageSelectedPicture.InitialImage
ImagefilePathText.Text = ""
ImageSelectionPanel.Visible = False
rslt.sIds = args.sIds
Case WORKERTYPE.PostMessage
bw.ReportProgress(200)
- If String.IsNullOrEmpty(args.imagePath) Then
+ If String.IsNullOrEmpty(args.status.imagePath) Then
For i As Integer = 0 To 1
ret = tw.PostStatus(args.status.status, args.status.inReplyToId)
If ret = "" OrElse _
Next
Else
Dim picSvc As New PictureService(tw)
- ret = picSvc.Upload(args.imagePath, args.status.status, args.imageService)
+ ret = picSvc.Upload(args.status.imagePath, args.status.status, args.status.imageService)
End If
bw.ReportProgress(300)
rslt.status = args.status
End If
If uid <> tw.Username Then Me.doGetFollowersMenu()
+
+ SetImageServiceCombo()
End SyncLock
End If
TimelinePanel.Visible = True
End If
End Sub
+
+ Private Sub SetImageServiceCombo()
+ ImageServiceCombo.Items.Clear()
+ If SettingDialog.IsOAuth Then
+ ImageServiceCombo.Items.Add("TwitPic")
+ End If
+ ImageServiceCombo.Items.Add("TwitVideo")
+ End Sub
End Class