OSDN Git Service

US受信で発言ID順の時はソートしないように変更
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Fri, 3 Dec 2010 14:48:26 +0000 (14:48 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:16:53 +0000 (23:16 +0900)
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@1161 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/StatusDictionary.vb
Tween/Tween.vb

index cdf2792..bc9c9c4 100644 (file)
@@ -789,7 +789,7 @@ Public NotInheritable Class TabInformations
         End SyncLock
     End Function
 
-    Public Function SubmitUpdate(ByRef soundFile As String, ByRef notifyPosts As PostClass(), ByRef isMentionIncluded As Boolean) As Integer
+    Public Function SubmitUpdate(ByRef soundFile As String, ByRef notifyPosts As PostClass(), ByRef isMentionIncluded As Boolean, ByVal isUserStream As Boolean) As Integer
         '注:メインスレッドから呼ぶこと
         SyncLock LockObj
             If _notifyPosts Is Nothing Then
@@ -804,7 +804,9 @@ Public NotInheritable Class TabInformations
                 End If
                 tb.AddSubmit(isMentionIncluded)  '振分確定(各タブに反映)
             Next
-            Me.SortPosts()
+            If Not isUserStream OrElse Me.SortMode <> IdComparerClass.ComparerMode.Id Then
+                Me.SortPosts()
+            End If
 
             soundFile = _soundFile
             _soundFile = ""
@@ -1571,7 +1573,15 @@ Public NotInheritable Class TabClass
     Private Sub Add(ByVal ID As Long, ByVal Read As Boolean)
         If Me._ids.Contains(ID) Then Exit Sub
 
-        Me._ids.Add(ID)
+        If Me.Sorter.Mode = IdComparerClass.ComparerMode.Id Then
+            If Me.Sorter.Order = SortOrder.Ascending Then
+                Me._ids.Add(ID)
+            Else
+                Me._ids.Insert(0, ID)
+            End If
+        Else
+            Me._ids.Add(ID)
+        End If
 
         If Not Read AndAlso Me._unreadManage Then
             Me._unreadCount += 1
@@ -1630,6 +1640,7 @@ Public NotInheritable Class TabClass
 
     Public Sub AddSubmit(ByRef isMentionIncluded As Boolean)
         If _tmpIds.Count = 0 Then Exit Sub
+        _tmpIds.Sort(Function(x As TemporaryId, y As TemporaryId) x.Id.CompareTo(y.Id))
         For Each tId As TemporaryId In _tmpIds
             If Me.TabType = TabUsageType.Mentions AndAlso TabInformations.GetInstance.Item(tId.Id).IsReply Then isMentionIncluded = True
             Me.Add(tId.Id, tId.Read)
index 699bc6b..ee49597 100644 (file)
@@ -1225,7 +1225,7 @@ Public Class TweenMain
 #End If
     End Sub
 
-    Private Sub RefreshTimeline()
+    Private Sub RefreshTimeline(ByVal isUserStream As Boolean)
         'スクロール制御準備
         Dim smode As Integer = -1    '-1:制御しない,-2:最新へ,その他:topitem使用
         Dim topId As Long = GetScrollPos(smode)
@@ -1244,7 +1244,7 @@ Public Class TweenMain
         Dim soundFile As String = ""
         Dim addCount As Integer = 0
         Dim isMention As Boolean = False
-        addCount = _statuses.SubmitUpdate(soundFile, notifyPosts, isMention)
+        addCount = _statuses.SubmitUpdate(soundFile, notifyPosts, isMention, isUserStream)
 
         If _endingFlag Then Exit Sub
 
@@ -2288,7 +2288,7 @@ Public Class TweenMain
            rslt.type = WORKERTYPE.FavAdd OrElse _
            rslt.type = WORKERTYPE.FavRemove OrElse _
            rslt.type = WORKERTYPE.Related Then
-            RefreshTimeline() 'リスト反映
+            RefreshTimeline(False) 'リスト反映
         End If
 
         Select Case rslt.type
@@ -9792,7 +9792,7 @@ RETRY:
         For Each tb As TabPage In ListTab.TabPages
             DirectCast(tb.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(tb.Text).AllCount
         Next
-        Me.RefreshTimeline()
+        Me.RefreshTimeline(True)
     End Sub
 
     Private Sub tw_NewPostFromStream()
@@ -9830,7 +9830,7 @@ RETRY:
 
         Try
             If InvokeRequired AndAlso Not IsDisposed Then
-                Invoke(New MethodInvoker(AddressOf RefreshTimeline))
+                Invoke(New Action(Of Boolean)(AddressOf RefreshTimeline), True)
                 Exit Sub
             End If
         Catch ex As ObjectDisposedException