svnno****@sourc*****
svnno****@sourc*****
2011年 5月 11日 (水) 12:07:07 JST
Revision: 1527 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1527 Author: kiri_feather Date: 2011-05-11 12:07:07 +0900 (Wed, 11 May 2011) Log Message: ----------- ネットワーク状態取得が例外出すことがあるので対応 Modified Paths: -------------- trunk/Tween/MyCommon.vb trunk/Tween/Tween.vb trunk/Tween/Twitter.vb -------------- next part -------------- Modified: trunk/Tween/MyCommon.vb =================================================================== --- trunk/Tween/MyCommon.vb 2011-05-10 04:28:17 UTC (rev 1526) +++ trunk/Tween/MyCommon.vb 2011-05-11 03:07:07 UTC (rev 1527) @@ -30,6 +30,7 @@ Imports System.Web Imports System.IO Imports System.Runtime.Serialization.Json +Imports System.Net.NetworkInformation Public Module MyCommon Private ReadOnly LockObj As New Object @@ -621,4 +622,12 @@ End Using Return data End Function + + Public Function IsNetworkAvailable() As Boolean + Try + Return NetworkInterface.GetIsNetworkAvailable + Catch ex As Exception + Return False + End Try + End Function End Module \ No newline at end of file Modified: trunk/Tween/Tween.vb =================================================================== --- trunk/Tween/Tween.vb 2011-05-10 04:28:17 UTC (rev 1526) +++ trunk/Tween/Tween.vb 2011-05-11 03:07:07 UTC (rev 1527) @@ -2526,7 +2526,7 @@ End Sub Private Sub GetTimeline(ByVal WkType As WORKERTYPE, ByVal fromPage As Integer, ByVal toPage As Integer, ByVal tabName As String) - If Not IsNetworkAvailable() Then Exit Sub + If Not Me.IsNetworkAvailable() Then Exit Sub '非同期実行引数設定 Dim args As New GetWorkerArg @@ -8233,11 +8233,7 @@ Public Function IsNetworkAvailable() As Boolean Dim nw As Boolean = True - Try - nw = My.Computer.Network.IsAvailable - Catch ex As Exception - nw = False - End Try + nw = MyCommon.IsNetworkAvailable _myStatusOnline = nw Return nw End Function @@ -8398,7 +8394,7 @@ NotifyIcon1.Visible = True - If IsNetworkAvailable() Then + If Me.IsNetworkAvailable() Then GetTimeline(WORKERTYPE.BlockIds, 0, 0, "") If SettingDialog.StartupFollowers Then GetTimeline(WORKERTYPE.Follower, 0, 0, "") Modified: trunk/Tween/Twitter.vb =================================================================== --- trunk/Tween/Twitter.vb 2011-05-10 04:28:17 UTC (rev 1526) +++ trunk/Tween/Twitter.vb 2011-05-11 03:07:07 UTC (rev 1527) @@ -3218,7 +3218,7 @@ Dim sr As StreamReader = Nothing Do Try - If Not NetworkInterface.GetIsNetworkAvailable Then + If Not MyCommon.IsNetworkAvailable() Then Thread.Sleep(30 * 1000) Continue Do End If