Imports System.Web
Imports System.IO
Imports System.Runtime.Serialization.Json
+Imports System.Net.NetworkInformation
Public Module MyCommon
Private ReadOnly LockObj As New Object
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
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
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
NotifyIcon1.Visible = True
- If IsNetworkAvailable() Then
+ If Me.IsNetworkAvailable() Then
GetTimeline(WORKERTYPE.BlockIds, 0, 0, "")
If SettingDialog.StartupFollowers Then
GetTimeline(WORKERTYPE.Follower, 0, 0, "")
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