svnno****@sourc*****
svnno****@sourc*****
2010年 12月 14日 (火) 22:58:43 JST
Revision: 1207 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1207 Author: kiri_feather Date: 2010-12-14 22:58:43 +0900 (Tue, 14 Dec 2010) Log Message: ----------- 画像サムネイルの取得開始・正常完了のメッセージを残さないように変更 Userstreamが動いているときは、timeline/mentions/dmの定期取得を停止。動いていないときはUserstreamの定期反映を停止。 Userstreamが動いているかを明確に判断するため状態フラグ化。 Modified Paths: -------------- trunk/Tween/Thumbnail.vb trunk/Tween/Tween.vb trunk/Tween/Twitter.vb -------------- next part -------------- Modified: trunk/Tween/Thumbnail.vb =================================================================== --- trunk/Tween/Thumbnail.vb 2010-12-14 12:05:23 UTC (rev 1206) +++ trunk/Tween/Thumbnail.vb 2010-12-14 13:58:43 UTC (rev 1207) @@ -184,9 +184,9 @@ Private Sub ThumbnailProgressChanged(ByVal ProgressPercentage As Integer, Optional ByVal AddMsg As String = "") If ProgressPercentage = 0 Then '開始 - Owner.SetStatusLabel("Thumbnail generating...") + 'Owner.SetStatusLabel("Thumbnail generating...") ElseIf ProgressPercentage = 100 Then '正常終了 - Owner.SetStatusLabel("Thumbnail generated.") + 'Owner.SetStatusLabel("Thumbnail generated.") Else ' エラー If String.IsNullOrEmpty(AddMsg) Then Owner.SetStatusLabel("can't get Thumbnail.") Modified: trunk/Tween/Tween.vb =================================================================== --- trunk/Tween/Tween.vb 2010-12-14 12:05:23 UTC (rev 1206) +++ trunk/Tween/Tween.vb 2010-12-14 13:58:43 UTC (rev 1207) @@ -1209,15 +1209,15 @@ 'Interlocked.Add(period, -_homeCounterAdjuster) 'Interlocked.Exchange(_homeCounter, period) Interlocked.Exchange(homeCounter, SettingDialog.TimelinePeriodInt) - GetTimeline(WORKERTYPE.Timeline, 1, 0, "") + If Not Me._isActiveUserstream Then GetTimeline(WORKERTYPE.Timeline, 1, 0, "") End If If mentionCounter <= 0 AndAlso SettingDialog.ReplyPeriodInt > 0 Then Interlocked.Exchange(mentionCounter, SettingDialog.ReplyPeriodInt) - GetTimeline(WORKERTYPE.Reply, 1, 0, "") + If Not Me._isActiveUserstream Then GetTimeline(WORKERTYPE.Reply, 1, 0, "") End If If dmCounter <= 0 AndAlso SettingDialog.DMPeriodInt > 0 Then Interlocked.Exchange(dmCounter, SettingDialog.DMPeriodInt) - GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "") + If Not Me._isActiveUserstream Then GetTimeline(WORKERTYPE.DirectMessegeRcv, 1, 0, "") End If If pubSearchCounter <= 0 AndAlso SettingDialog.PubSearchPeriodInt > 0 Then Interlocked.Exchange(pubSearchCounter, SettingDialog.PubSearchPeriodInt) @@ -1229,7 +1229,7 @@ End If If usCounter <= 0 AndAlso SettingDialog.UserstreamPeriodInt > 0 Then Interlocked.Exchange(usCounter, SettingDialog.UserstreamPeriodInt) - RefreshTimeline(True) + If Me._isActiveUserstream Then RefreshTimeline(True) End If End Sub @@ -9830,6 +9830,9 @@ MessageBox.Show(buf.ToString, "アイコンキャッシュ使用状況") End Sub +#Region "Userstream" + Private _isActiveUserstream As Boolean = False + Private Sub tw_PostDeleted(ByVal id As Long, ByRef post As PostClass) _statuses.RemovePostReserve(id, post) End Sub @@ -9878,7 +9881,9 @@ Exit Sub End Try End Sub + Private Sub tw_UserStreamStarted() + Me._isActiveUserstream = True If InvokeRequired Then Invoke(New MethodInvoker(AddressOf tw_UserStreamStarted)) Exit Sub @@ -9893,6 +9898,7 @@ End Sub Private Sub tw_UserStreamStopped() + Me._isActiveUserstream = False If InvokeRequired Then Invoke(New MethodInvoker(AddressOf tw_UserStreamStopped)) Exit Sub @@ -9916,7 +9922,11 @@ Private Sub StopToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StopToolStripMenuItem.Click MenuItemUserStream.Enabled = False - tw.StartUserStream() + If Me._isActiveUserstream Then + tw.StopUserStream() + Else + tw.StartUserStream() + End If End Sub Private Sub TrackToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackToolStripMenuItem.Click @@ -9955,6 +9965,16 @@ Application.Restart() End Sub + Private Sub EventViewerMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EventViewerMenuItem.Click + Using dlg As New EventViewerDialog + dlg.Owner = Me + dlg.EventSource = tw.StoredEvent + dlg.ShowDialog() + Me.TopMost = SettingDialog.AlwaysTop + End Using + End Sub +#End Region + Private Sub OpenOwnFavedMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles OpenOwnFavedMenuItem.Click If Not tw.Username = "" Then OpenUriAsync(My.Resources.FavstarUrl + "users/" + tw.Username + "/recent") End Sub @@ -9963,12 +9983,4 @@ OpenUriAsync("http://twitter.com/" + tw.Username) End Sub - Private Sub EventViewerMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EventViewerMenuItem.Click - Using dlg As New EventViewerDialog - dlg.Owner = Me - dlg.EventSource = tw.StoredEvent - dlg.ShowDialog() - Me.TopMost = SettingDialog.AlwaysTop - End Using - End Sub End Class Modified: trunk/Tween/Twitter.vb =================================================================== --- trunk/Tween/Twitter.vb 2010-12-14 12:05:23 UTC (rev 1206) +++ trunk/Tween/Twitter.vb 2010-12-14 13:58:43 UTC (rev 1207) @@ -2958,13 +2958,12 @@ End Get End Property - Public Overloads Sub StartUserStream() + Public Sub StartUserStream() If userStream IsNot Nothing Then StopUserStream() - Else - userStream = New TwitterUserstream(twCon) - userStream.Start(Me.AllAtReply, Me.TrackWord) End If + userStream = New TwitterUserstream(twCon) + userStream.Start(Me.AllAtReply, Me.TrackWord) End Sub Public Sub StopUserStream() @@ -2975,7 +2974,6 @@ Public Sub ReconnectUserStream() If userStream IsNot Nothing Then - Me.StopUserStream() Me.StartUserStream() End If End Sub