mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-25 19:38:37 +08:00
Fix ThreadStateException.
This commit is contained in:
@@ -711,6 +711,7 @@ Namespace App
|
||||
_LoadUpdate = True
|
||||
|
||||
Dim t As New Thread(AddressOf LoadConnectionsBGd)
|
||||
t.SetApartmentState(Threading.ApartmentState.STA)
|
||||
t.Start()
|
||||
End Sub
|
||||
|
||||
@@ -1081,6 +1082,7 @@ Namespace App
|
||||
_SaveUpdate = True
|
||||
|
||||
Dim t As New Thread(AddressOf SaveConnectionsBGd)
|
||||
t.SetApartmentState(Threading.ApartmentState.STA)
|
||||
t.Start()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ Namespace Connection
|
||||
|
||||
Public Overridable Sub Close()
|
||||
Dim t As New Thread(AddressOf CloseBG)
|
||||
t.SetApartmentState(Threading.ApartmentState.STA)
|
||||
t.IsBackground = True
|
||||
t.Start()
|
||||
End Sub
|
||||
|
||||
@@ -62,6 +62,7 @@ Namespace Tools
|
||||
Public Shared Event SQLUpdateCheckFinished(ByVal UpdateAvailable As Boolean)
|
||||
Public Shared Sub IsSQLUpdateAvailableBG()
|
||||
Dim t As New Threading.Thread(AddressOf IsSQLUpdateAvailable)
|
||||
t.SetApartmentState(Threading.ApartmentState.STA)
|
||||
t.Start()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -395,6 +395,7 @@ Namespace Tools
|
||||
|
||||
Public Sub StartScan()
|
||||
sThread = New Thread(AddressOf StartScanBG)
|
||||
sThread.SetApartmentState(Threading.ApartmentState.STA)
|
||||
sThread.IsBackground = True
|
||||
sThread.Start()
|
||||
End Sub
|
||||
|
||||
@@ -67,8 +67,8 @@ Namespace UI
|
||||
Public Sub CheckForAnnouncement()
|
||||
Try
|
||||
uT = New Thread(AddressOf CheckForAnnouncementBG)
|
||||
uT.SetApartmentState(ApartmentState.STA)
|
||||
uT.IsBackground = True
|
||||
'uT.SetApartmentState(ApartmentState.STA)
|
||||
|
||||
If Me.IsAnnouncementCheckHandlerDeclared = False Then
|
||||
AddHandler AnnouncementCheckCompleted, AddressOf AnnouncementCheckComplete
|
||||
|
||||
@@ -1278,6 +1278,7 @@ Namespace UI
|
||||
Me.btnHostStatus.Tag = "checking"
|
||||
HostName = TryCast(ConnectionInfo, mRemoteNG.Connection.Info).Hostname
|
||||
pThread = New Threading.Thread(AddressOf CheckHostAlive)
|
||||
pThread.SetApartmentState(Threading.ApartmentState.STA)
|
||||
pThread.IsBackground = True
|
||||
pThread.Start()
|
||||
Catch ex As Exception
|
||||
|
||||
@@ -395,9 +395,8 @@ Namespace UI
|
||||
RemoteFile = Me.txtRemoteFile.Text
|
||||
|
||||
Dim t As New Thread(AddressOf StartTransferBG)
|
||||
|
||||
t.IsBackground = True
|
||||
t.SetApartmentState(ApartmentState.STA)
|
||||
t.IsBackground = True
|
||||
t.Start()
|
||||
Catch ex As Exception
|
||||
mC.AddMessage(Messages.MessageClass.ErrorMsg, My.Resources.strSSHTransferFailed & vbNewLine & ex.Message)
|
||||
|
||||
@@ -355,8 +355,8 @@ Namespace UI
|
||||
tDomain = Domain
|
||||
|
||||
threadSessions = New Threading.Thread(AddressOf GetSessionsBG)
|
||||
threadSessions.IsBackground = True
|
||||
threadSessions.SetApartmentState(Threading.ApartmentState.STA)
|
||||
threadSessions.IsBackground = True
|
||||
threadSessions.Start()
|
||||
Catch ex As Exception
|
||||
mC.AddMessage(Messages.MessageClass.ErrorMsg, "GetSessions (UI.Window.Sessions) failed" & vbNewLine & ex.Message, True)
|
||||
@@ -398,8 +398,8 @@ Namespace UI
|
||||
tSessionID = SessionID
|
||||
|
||||
threadSessions = New Threading.Thread(AddressOf KillSessionBG)
|
||||
threadSessions.IsBackground = True
|
||||
threadSessions.SetApartmentState(Threading.ApartmentState.STA)
|
||||
threadSessions.IsBackground = True
|
||||
threadSessions.Start()
|
||||
Catch ex As Exception
|
||||
mC.AddMessage(Messages.MessageClass.ErrorMsg, "KillSession (UI.Window.Sessions) failed" & vbNewLine & ex.Message, True)
|
||||
|
||||
@@ -217,8 +217,8 @@ Namespace UI
|
||||
Public Sub CheckForUpdate()
|
||||
Try
|
||||
uT = New Thread(AddressOf CheckForUpdateBG)
|
||||
uT.SetApartmentState(ApartmentState.STA)
|
||||
uT.IsBackground = True
|
||||
'uT.SetApartmentState(ApartmentState.STA)
|
||||
|
||||
If Me.IsUpdateCheckHandlerDeclared = False Then
|
||||
AddHandler UpdateCheckCompleted, AddressOf UpdateCheckComplete
|
||||
|
||||
Reference in New Issue
Block a user