Public Function GetContent(ByVal method As String, _
ByVal requestUri As Uri, _
ByVal param As Dictionary(Of String, String), _
- ByRef content As Stream) As HttpStatusCode Implements IHttpConnection.GetContent
+ ByRef content As Stream,
+ ByVal userAgent As String) As HttpStatusCode Implements IHttpConnection.GetContent
'認証済かチェック
If String.IsNullOrEmpty(Me.credential) Then Return HttpStatusCode.Unauthorized
streamReq = CreateRequest(method, requestUri, param, False)
+ 'User-Agent指定がある場合は付加
+ If Not String.IsNullOrEmpty(userAgent) Then streamReq.UserAgent = userAgent
'BASIC認証用ヘッダを付加
AppendApiInfo(streamReq)
Public Function GetContent(ByVal method As String, _
ByVal requestUri As Uri, _
ByVal param As Dictionary(Of String, String), _
- ByRef content As Stream) As HttpStatusCode Implements IHttpConnection.GetContent
+ ByRef content As Stream,
+ ByVal userAgent As String) As HttpStatusCode Implements IHttpConnection.GetContent
'認証済かチェック
If String.IsNullOrEmpty(token) Then Return HttpStatusCode.Unauthorized
streamReq = CreateRequest(method, requestUri, param, False)
+ 'User-Agent指定がある場合は付加
+ If Not String.IsNullOrEmpty(userAgent) Then streamReq.UserAgent = userAgent
+
'OAuth認証ヘッダを付加
AppendOAuthInfo(streamReq, param, token, tokenSecret)
End If
End Sub
- Public Function UserStream(ByRef content As Stream, ByVal allAtReplies As Boolean, ByVal trackwords As String) As HttpStatusCode
+ Public Function UserStream(ByRef content As Stream,
+ ByVal allAtReplies As Boolean,
+ ByVal trackwords As String,
+ ByVal userAgent As String) As HttpStatusCode
Dim param As New Dictionary(Of String, String)
If allAtReplies Then
Return httpCon.GetContent(GetMethod, _
CreateTwitterStreamUri("/2/user.json"), _
param, _
- content)
+ content,
+ userAgent)
End Function
Public Sub RequestAbort()
Function GetContent(ByVal method As String, _
ByVal requestUri As Uri, _
ByVal param As Dictionary(Of String, String), _
- ByRef content As Stream) As HttpStatusCode
+ ByRef content As Stream,
+ ByVal userAgent As String) As HttpStatusCode
Function GetContent(ByVal method As String, _
ByVal requestUri As Uri, _
Me.Visible AndAlso _
Me.WindowState = FormWindowState.Normal Then
- Dim colNo As Integer = 2
- If _iconCol Then colNo = 1
- Dim widthDiff As Integer = Me.ClientSize.Width - Me._mySize.Width
- Dim listView As DetailsListView = CType(Me._curTab.Tag, DetailsListView)
- Dim column As ColumnHeader = listView.Columns(colNo)
- column.Width += widthDiff
- Me.MyList_ColumnWidthChanged(listView, New ColumnWidthChangedEventArgs(colNo))
+ 'Dim colNo As Integer = 2
+ 'If _iconCol Then colNo = 1
+ 'Dim widthDiff As Integer = Me.ClientSize.Width - Me._mySize.Width
+ 'Dim listView As DetailsListView = CType(Me._curTab.Tag, DetailsListView)
+ 'Dim column As ColumnHeader = listView.Columns(colNo)
+ 'column.Width += widthDiff
+ 'Me.MyList_ColumnWidthChanged(listView, New ColumnWidthChangedEventArgs(colNo))
_mySize = Me.ClientSize
_mySpDis = Me.SplitContainer1.SplitterDistance
evt.Target = eventData.TargetObject.Name
Case "block"
evt.Target = ""
+ Case "user_update"
+ evt.Target = ""
Case Else
TraceOut("Unknown Event:" + evt.Event + Environment.NewLine + content)
End Select
RaiseEvent Started()
- twCon.UserStream(st, _allAtreplies, _trackwords)
+ twCon.UserStream(st, _allAtreplies, _trackwords, My.Application.Info.ProductName + " v" + fileVersion)
sr = New StreamReader(st)
Do While _streamActive AndAlso Not sr.EndOfStream
RaiseEvent Stopped()
TraceOut("Stop:Timeout")
Thread.Sleep(10 * 1000)
+ ElseIf CType(ex.Response, HttpWebResponse).StatusCode = 420 Then
+ TraceOut("Stop:Connection Limit")
+ Exit Do
Else
RaiseEvent Stopped()
TraceOut("Stop:WebException " & ex.Status.ToString)