From b9b83db77dd8460c25a579599b2f05dfc5e97c60 Mon Sep 17 00:00:00 2001 From: kiri_feather Date: Wed, 11 May 2011 12:07:07 +0900 Subject: [PATCH] =?utf8?q?=E3=83=8D=E3=83=83=E3=83=88=E3=83=AF=E3=83=BC?= =?utf8?q?=E3=82=AF=E7=8A=B6=E6=85=8B=E5=8F=96=E5=BE=97=E3=81=8C=E4=BE=8B?= =?utf8?q?=E5=A4=96=E5=87=BA=E3=81=99=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82?= =?utf8?q?=E3=82=8B=E3=81=AE=E3=81=A7=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Tween/MyCommon.vb | 9 +++++++++ Tween/Tween.vb | 10 +++------- Tween/Twitter.vb | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Tween/MyCommon.vb b/Tween/MyCommon.vb index ed3e32a2..50214b1c 100644 --- a/Tween/MyCommon.vb +++ b/Tween/MyCommon.vb @@ -30,6 +30,7 @@ Imports System.Reflection 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 @@ retry: 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 diff --git a/Tween/Tween.vb b/Tween/Tween.vb index 06f421a1..8a093c53 100644 --- a/Tween/Tween.vb +++ b/Tween/Tween.vb @@ -2526,7 +2526,7 @@ Public Class TweenMain 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 @@ RETRY: 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 @@ RETRY: NotifyIcon1.Visible = True - If IsNetworkAvailable() Then + If Me.IsNetworkAvailable() Then GetTimeline(WORKERTYPE.BlockIds, 0, 0, "") If SettingDialog.StartupFollowers Then GetTimeline(WORKERTYPE.Follower, 0, 0, "") diff --git a/Tween/Twitter.vb b/Tween/Twitter.vb index a9b88672..209f4c6b 100644 --- a/Tween/Twitter.vb +++ b/Tween/Twitter.vb @@ -3218,7 +3218,7 @@ Public Class Twitter 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 -- 2.11.0