mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
* Fixed some german grammer mistakes * Changed some weird translations * moved all language strings to resx files * added missing translations * removed old language classes
136 lines
5.7 KiB
VB.net
136 lines
5.7 KiB
VB.net
Imports WeifenLuo.WinFormsUI.Docking
|
|
Imports System.Reflection
|
|
Imports mRemote.App.Runtime
|
|
|
|
Namespace UI
|
|
Namespace Window
|
|
Public Class QuickConnect
|
|
Inherits UI.Window.Base
|
|
|
|
#Region "Form Init"
|
|
Friend WithEvents btnCancel As System.Windows.Forms.Button
|
|
Friend WithEvents flpProtocols As System.Windows.Forms.FlowLayoutPanel
|
|
|
|
Private Sub InitializeComponent()
|
|
Me.flpProtocols = New System.Windows.Forms.FlowLayoutPanel
|
|
Me.btnCancel = New System.Windows.Forms.Button
|
|
Me.SuspendLayout()
|
|
'
|
|
'flpProtocols
|
|
'
|
|
Me.flpProtocols.Dock = System.Windows.Forms.DockStyle.Fill
|
|
Me.flpProtocols.Location = New System.Drawing.Point(0, 0)
|
|
Me.flpProtocols.Name = "flpProtocols"
|
|
Me.flpProtocols.Size = New System.Drawing.Size(271, 155)
|
|
Me.flpProtocols.TabIndex = 10
|
|
'
|
|
'btnCancel
|
|
'
|
|
Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
|
|
Me.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat
|
|
Me.btnCancel.Location = New System.Drawing.Point(-200, -200)
|
|
Me.btnCancel.Name = "btnCancel"
|
|
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
|
|
Me.btnCancel.TabIndex = 20
|
|
Me.btnCancel.TabStop = False
|
|
Me.btnCancel.Text = My.Resources.strButtonCancel
|
|
Me.btnCancel.UseVisualStyleBackColor = True
|
|
'
|
|
'QuickConnect
|
|
'
|
|
Me.CancelButton = Me.btnCancel
|
|
Me.ClientSize = New System.Drawing.Size(271, 155)
|
|
Me.Controls.Add(Me.btnCancel)
|
|
Me.Controls.Add(Me.flpProtocols)
|
|
Me.HideOnClose = True
|
|
Me.Icon = Global.mRemote.My.Resources.Resources.Play_Quick_Icon
|
|
Me.Name = "QuickConnect"
|
|
Me.TabText = My.Resources.strQuickConnect
|
|
Me.Text = My.Resources.strQuickConnect
|
|
Me.ResumeLayout(False)
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Public Methods"
|
|
Public Sub New(ByVal Panel As DockContent)
|
|
Me.WindowType = Type.Connection
|
|
Me.DockPnl = Panel
|
|
Me.InitializeComponent()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Public Properties"
|
|
Private _ConnectionInfo As mRemote.Connection.Info
|
|
Public Property ConnectionInfo() As mRemote.Connection.Info
|
|
Get
|
|
Return Me._ConnectionInfo
|
|
End Get
|
|
Set(ByVal value As mRemote.Connection.Info)
|
|
Me._ConnectionInfo = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
|
|
Me.Hide()
|
|
End Sub
|
|
|
|
Private Sub QuickConnect_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
|
ApplyLanguage()
|
|
|
|
Me.CreateButtons()
|
|
|
|
Me.flpProtocols.Controls(0).Focus()
|
|
End Sub
|
|
|
|
Private Sub ApplyLanguage()
|
|
btnCancel.Text = My.Resources.strButtonCancel
|
|
TabText = My.Resources.strQuickConnect
|
|
Text = My.Resources.strQuickConnect
|
|
End Sub
|
|
|
|
Private Sub CreateButtons()
|
|
Try
|
|
For Each fI As FieldInfo In GetType(mRemote.Connection.Protocol.Protocols).GetFields
|
|
If fI.Name <> "value__" And fI.Name <> "NONE" And fI.Name <> "IntApp" Then
|
|
Dim nBtn As New Button
|
|
nBtn.Text = fI.Name
|
|
nBtn.FlatStyle = FlatStyle.Flat
|
|
nBtn.Size = New Size(60, 40)
|
|
nBtn.Parent = Me.flpProtocols
|
|
AddHandler nBtn.Click, AddressOf ProtocolButton_Click
|
|
nBtn.Show()
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
mC.AddMessage(Messages.MessageClass.ErrorMsg, "CreateButtons (UI.Window.QuickConnect) failed" & vbNewLine & ex.Message, True)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub ProtocolButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
|
|
Try
|
|
Me._ConnectionInfo.Protocol = Tools.Misc.StringToEnum(GetType(mRemote.Connection.Protocol.Protocols), sender.Text)
|
|
|
|
If Me._ConnectionInfo.Port = 0 Then
|
|
Me._ConnectionInfo.SetDefaultPort()
|
|
|
|
If mRemote.Connection.QuickConnect.History.Exists(Me._ConnectionInfo.Hostname) = False Then
|
|
mRemote.Connection.QuickConnect.History.Add(Me._ConnectionInfo.Hostname)
|
|
End If
|
|
Else
|
|
If mRemote.Connection.QuickConnect.History.Exists(Me._ConnectionInfo.Hostname) = False Then
|
|
mRemote.Connection.QuickConnect.History.Add(Me._ConnectionInfo.Hostname & ":" & Me._ConnectionInfo.Port)
|
|
End If
|
|
End If
|
|
|
|
App.Runtime.OpenConnection(Me._ConnectionInfo, mRemote.Connection.Info.Force.DoNotJump)
|
|
|
|
Me.Hide()
|
|
Catch ex As Exception
|
|
mC.AddMessage(Messages.MessageClass.ErrorMsg, "ProtocolButton_Click (UI.Window.QuickConnect) failed" & vbNewLine & ex.Message, True)
|
|
End Try
|
|
End Sub
|
|
End Class
|
|
End Namespace
|
|
End Namespace |