[Tween-svn] [1393] 詳細表示の際にアイコンの読み込みが間に合っていない場合1秒後に再度設定を試みるようにした

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2011年 1月 20日 (木) 23:20:03 JST


Revision: 1393
          http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1393
Author:   syo68k
Date:     2011-01-20 23:20:03 +0900 (Thu, 20 Jan 2011)

Log Message:
-----------
詳細表示の際にアイコンの読み込みが間に合っていない場合1秒後に再度設定を試みるようにした

Modified Paths:
--------------
    trunk/Tween/Tween.vb


-------------- next part --------------
Modified: trunk/Tween/Tween.vb
===================================================================
--- trunk/Tween/Tween.vb	2011-01-20 13:56:07 UTC (rev 1392)
+++ trunk/Tween/Tween.vb	2011-01-20 14:20:03 UTC (rev 1393)
@@ -4620,6 +4620,13 @@
         Return detailHtmlFormatHeader + orgdata + detailHtmlFormatFooter
     End Function
 
+    Private Sub SetUserPicture()
+        Thread.Sleep(1000)       ' 要調整
+        If Not String.IsNullOrEmpty(_curPost.ImageUrl) AndAlso TIconDic.ContainsKey(_curPost.ImageUrl) Then
+            UserPicture.Image = TIconDic(_curPost.ImageUrl)
+        End If
+    End Sub
+
     Private Overloads Sub DispSelectedPost()
         DispSelectedPost(False)
     End Sub
@@ -4676,17 +4683,13 @@
         If UserPicture.Image IsNot Nothing Then UserPicture.Image.Dispose()
         If Not String.IsNullOrEmpty(_curPost.ImageUrl) AndAlso TIconDic.ContainsKey(_curPost.ImageUrl) Then
             UserPicture.Image = TIconDic(_curPost.ImageUrl)
-
-            'Dim dummy As Image = DirectCast(TIconDic, ImageDictionary)(_curPost.ImageUrl, Sub(getImg)
-            '                                                                                  If img IsNot Nothing Then img.Dispose()
-            '                                                                                  If getImg Is Nothing Then Exit Sub
-            '                                                                                  img = DirectCast(getImg.Clone(), Image)
-            '                                                                                  Me.Invoke(Sub()
-            '                                                                                                Me.UserPicture.Image = img
-            '                                                                                            End Sub)
-            '                                                                              End Sub)
         Else
             UserPicture.Image = Nothing
+
+            Dim proc As New Thread(New Threading.ThreadStart(Sub()
+                                                                 If Me.IsHandleCreated AndAlso Not Me.IsDisposed Then Invoke(New MethodInvoker(AddressOf SetUserPicture))
+                                                             End Sub))
+            proc.Start()
         End If
 
         NameLabel.ForeColor = System.Drawing.SystemColors.ControlText



Tween-svn メーリングリストの案内
アーカイブの一覧に戻る