[Tween-svn] [1255] 設定画面でユーザーID、パスワードにフォーカスがある場合のEnterキーは認証処理

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2010年 12月 26日 (日) 01:42:01 JST


Revision: 1255
          http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1255
Author:   kiri_feather
Date:     2010-12-26 01:42:01 +0900 (Sun, 26 Dec 2010)

Log Message:
-----------
設定画面でユーザーID、パスワードにフォーカスがある場合のEnterキーは認証処理
発言削除イベントは即時処理へ
Fav済み発言をRTされると自分がFavした状態で反映されてしまう問題に対応
関連発言表示したとき、対象発言を選択済みで表示
fav/unfavイベントの反映を早めに
RT削除もイベントとして扱うように(ログのみ)
自分が行ったfav/unfavイベントは無視するように

Modified Paths:
--------------
    trunk/Tween/AppendSettingDialog.vb
    trunk/Tween/StatusDictionary.vb
    trunk/Tween/Tween.vb
    trunk/Tween/Twitter.vb


-------------- next part --------------
Modified: trunk/Tween/AppendSettingDialog.vb
===================================================================
--- trunk/Tween/AppendSettingDialog.vb	2010-12-25 08:51:31 UTC (rev 1254)
+++ trunk/Tween/AppendSettingDialog.vb	2010-12-25 16:42:01 UTC (rev 1255)
@@ -152,6 +152,12 @@
         Else
             _ValidationError = False
         End If
+        If Me.Username.Focused OrElse Me.Password.Focused Then
+            If Not Authorize() Then
+                _ValidationError = True
+                Exit Sub
+            End If
+        End If
         Try
             _MyUserstreamPeriod = CType(Me.UserstreamPeriod.Text, Integer)
             _MyUserstreamStartup = Me.StartupUserstreamCheck.Checked
@@ -1914,12 +1920,12 @@
         lblRetweet.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Green)
     End Sub
 
-    Private Sub AuthorizeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorizeButton.Click
+    Private Function Authorize() As Boolean
         Dim user As String = Me.Username.Text.Trim
         Dim pwd As String = Me.Password.Text.Trim
         If String.IsNullOrEmpty(user) OrElse String.IsNullOrEmpty(pwd) Then
             MessageBox.Show(My.Resources.Save_ClickText1)
-            Exit Sub
+            Return False
         End If
 
         '現在の設定内容で通信
@@ -1950,12 +1956,17 @@
             MessageBox.Show(My.Resources.AuthorizeButton_Click1, "Authenticate", MessageBoxButtons.OK)
             Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click3
             Me.AuthUserLabel.Text = tw.Username
+            Return True
         Else
             MessageBox.Show(My.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK)
             Me.AuthStateLabel.Text = My.Resources.AuthorizeButton_Click4
             Me.AuthUserLabel.Text = ""
+            Return False
         End If
-        CalcApiUsing()
+    End Function
+
+    Private Sub AuthorizeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorizeButton.Click
+        If Authorize() Then CalcApiUsing()
     End Sub
 
     Private Sub AuthClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthClearButton.Click

Modified: trunk/Tween/StatusDictionary.vb
===================================================================
--- trunk/Tween/StatusDictionary.vb	2010-12-25 08:51:31 UTC (rev 1254)
+++ trunk/Tween/StatusDictionary.vb	2010-12-25 16:42:01 UTC (rev 1255)
@@ -393,7 +393,7 @@
     Private _tabs As New Dictionary(Of String, TabClass)
     Private _statuses As New Dictionary(Of Long, PostClass)
     Private _addedIds As List(Of Long)
-    Private _deletedIds As New List(Of Long)
+    'Private _deletedIds As New List(Of Long)
     Private _retweets As New Dictionary(Of Long, PostClass)
     Private _removedTab As TabClass = Nothing
 
@@ -630,7 +630,8 @@
             post = Nothing
             Dim tmp As PostClass = Me.Item(id)
             If tmp IsNot Nothing Then post = tmp.Copy
-            Me._deletedIds.Add(id)
+            'Me._deletedIds.Add(id)
+            Me.DeletePost(id)
         End SyncLock
     End Sub
 
@@ -850,12 +851,12 @@
             If Not isUserStream OrElse Me.SortMode <> IdComparerClass.ComparerMode.Id Then
                 Me.SortPosts()
             End If
-            If isUserStream Then
-                For Each id As Long In Me._deletedIds
-                    Me.DeletePost(id)
-                Next
-                Me._deletedIds.Clear()
-            End If
+            'If isUserStream Then
+            '    For Each id As Long In Me._deletedIds
+            '        Me.DeletePost(id)
+            '    Next
+            '    Me._deletedIds.Clear()
+            'End If
 
             soundFile = _soundFile
             _soundFile = ""
@@ -956,11 +957,16 @@
                 If Not Item.IsDm Then
                     If _statuses.ContainsKey(Item.Id) Then
                         If Item.IsFav Then
-                            _statuses.Item(Item.Id).IsFav = True
+                            If Item.RetweetedId = 0 Then
+                                _statuses.Item(Item.Id).IsFav = True
+                            Else
+                                Item.IsFav = False
+                            End If
                         Else
                             Exit Sub        '追加済みなら何もしない
                         End If
                     Else
+                        If Item.IsFav AndAlso Item.RetweetedId > 0 Then Item.IsFav = False
                         _statuses.Add(Item.Id, Item)
                     End If
                     If Item.RetweetedId > 0 Then

Modified: trunk/Tween/Tween.vb
===================================================================
--- trunk/Tween/Tween.vb	2010-12-25 08:51:31 UTC (rev 1254)
+++ trunk/Tween/Tween.vb	2010-12-25 16:42:01 UTC (rev 1255)
@@ -2419,6 +2419,17 @@
                 _waitPubSearch = False
             Case WORKERTYPE.List
                 _waitLists = False
+            Case WORKERTYPE.Related
+                Dim tb As TabClass = _statuses.GetTabByType(TabUsageType.Related)
+                If tb IsNot Nothing AndAlso tb.RelationTargetPost IsNot Nothing AndAlso tb.Contains(tb.RelationTargetPost.Id) Then
+                    For Each tp As TabPage In ListTab.TabPages
+                        If tp.Text = tb.TabName Then
+                            DirectCast(tp.Tag, DetailsListView).SelectedIndices.Add(tb.IndexOf(tb.RelationTargetPost.Id))
+                            DirectCast(tp.Tag, DetailsListView).Items(tb.IndexOf(tb.RelationTargetPost.Id)).Focused = True
+                            Exit For
+                        End If
+                    Next
+                End If
         End Select
 
     End Sub
@@ -9862,6 +9873,21 @@
 
     Private Sub tw_PostDeleted(ByVal id As Long, ByRef post As PostClass)
         _statuses.RemovePostReserve(id, post)
+        Try
+            If InvokeRequired AndAlso Not IsDisposed Then
+                Invoke(Sub()
+                           If _curTab IsNot Nothing AndAlso _statuses.Tabs(_curTab.Text).Contains(id) Then
+                               _itemCache = Nothing
+                               _itemCacheIndex = -1
+                               _postCache = Nothing
+                               DirectCast(_curTab.Tag, DetailsListView).Update()
+                           End If
+                       End Sub)
+                Exit Sub
+            End If
+        Catch ex As ObjectDisposedException
+            Exit Sub
+        End Try
     End Sub
 
     Private Sub tw_NewPostFromStream()
@@ -9948,6 +9974,14 @@
         If ev.Event = "favorite" Then
             NotifyFavorite(ev)
         End If
+        If ev.Event = "favorite" OrElse ev.Event = "unfavorite" Then
+            If _curTab IsNot Nothing AndAlso _statuses.Tabs(_curTab.Text).Contains(ev.Id) Then
+                _itemCache = Nothing
+                _itemCacheIndex = -1
+                _postCache = Nothing
+                DirectCast(_curTab.Tag, DetailsListView).Update()
+            End If
+        End If
     End Sub
 
     Private Sub NotifyFavorite(ByVal ev As Twitter.FormattedEvent)

Modified: trunk/Tween/Twitter.vb
===================================================================
--- trunk/Tween/Twitter.vb	2010-12-25 08:51:31 UTC (rev 1254)
+++ trunk/Tween/Twitter.vb	2010-12-25 16:42:01 UTC (rev 1255)
@@ -2766,7 +2766,7 @@
         Public Property [Event] As String
         Public Property Username As String
         Public Property Target As String
-
+        Public Property Id As Int64
     End Class
 
     Public Property StoredEvent As New List(Of FormattedEvent)
@@ -2864,6 +2864,8 @@
         Else
             If post.IsDm Then
                 evt.Event = "DELETE(DM)"
+            ElseIf post.RetweetedId > 0 Then
+                evt.Event = "DELETE(RT)"
             Else
                 evt.Event = "DELETE(Post)"
             End If
@@ -2897,7 +2899,9 @@
                 End If
                 evt.Target = ""
             Case "favorite", "unfavorite"
+                If evt.Username.ToLower.Equals(_uid) Then Exit Sub
                 evt.Target = eventData.TargetObject.Text
+                evt.Id = eventData.TargetObject.Id
                 If TabInformations.GetInstance.ContainsKey(eventData.TargetObject.Id) Then
                     Dim post As PostClass = TabInformations.GetInstance.Item(eventData.TargetObject.Id)
                     If eventData.Event = "favorite" Then



Tween-svn メーリングリストの案内
Zurück zum Archiv-Index