Code optimization and bugfix #22

This commit is contained in:
Andreas Rehm
2011-02-20 12:19:05 +01:00
parent 69b4633e9e
commit 5b0ba26ecd
2 changed files with 17 additions and 14 deletions

View File

@@ -1,7 +1,5 @@
Imports mRemoteNG.App.Native
Imports System.Threading
Imports Microsoft.Win32
Imports System.Drawing
Imports mRemoteNG.App.Runtime
Namespace Connection
@@ -112,12 +110,11 @@ Namespace Connection
IntAppHandle = IntAppProcess.MainWindowHandle
mC.AddMessage(Messages.MessageClass.InformationMsg, My.Resources.strIntAppStuff, True)
mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppHandle, IntAppHandle.ToString), True)
mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppTitle, IntAppProcess.MainWindowTitle), True)
mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppParentHandle & Me.InterfaceControl.Parent.Handle.ToString), True)
mC.AddMessage(Messages.MessageClass.InformationMsg, String.Format(My.Resources.strIntAppParentHandle, Me.InterfaceControl.Parent.Handle.ToString), True)
SetParent(Me.IntAppHandle, Me.InterfaceControl.Parent.Handle)
SetWindowLong(Me.IntAppHandle, 0, WS_VISIBLE)

View File

@@ -103,16 +103,16 @@ Namespace Tools
_Arguments = Arguments
End Sub
' Start external app
Public Function Start(Optional ByVal ConnectionInfo As Connection.Info = Nothing) As Process
Try
If _TryIntegrate = True Then
StartIntApp(ConnectionInfo)
If _FileName = "" Then
Throw New Exception("No Filename specified!")
Return Nothing
End If
If _FileName = "" Then
Throw New Exception("No Filename specified!")
If _TryIntegrate = True Then
StartIntApp(ConnectionInfo)
Return Nothing
End If
@@ -139,20 +139,26 @@ Namespace Tools
End Try
End Function
' Start external app integrated
Public Sub StartIntApp(Optional ByVal ConnectionInfo As Connection.Info = Nothing)
Try
If _FileName = "" Then
Throw New Exception("No Filename specified!")
Exit Sub
End If
_ConnectionInfo = ConnectionInfo
Dim nCI As New Connection.Info
nCI.Protocol = Connection.Protocol.Protocols.IntApp
nCI.ExtApp = Me.DisplayName
nCI.Name = Me.DisplayName
nCI.Panel = "Int. Apps"
nCI.Hostname = _ConnectionInfo.Hostname
nCI.Port = _ConnectionInfo.Port
nCI.Username = _ConnectionInfo.Username
nCI.Password = _ConnectionInfo.Password
nCI.Domain = _ConnectionInfo.Domain
nCI.Description = _ConnectionInfo.Description
nCI.MacAddress = _ConnectionInfo.MacAddress
nCI.UserField = _ConnectionInfo.UserField
nCI.Description = _ConnectionInfo.Description
OpenConnection(nCI)
Catch ex As Exception