Files
mRemoteNG/mRemoteV1/UI/UI.Window.Export.vb
2013-02-14 20:57:16 -06:00

208 lines
10 KiB
VB.net

Imports WeifenLuo.WinFormsUI.Docking
Imports mRemoteNG.App.Runtime
Namespace UI
Namespace Window
Public Class Export
Inherits UI.Window.Base
#Region "Form Init"
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents lvSecurity As System.Windows.Forms.ListView
Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
Friend WithEvents btnOK As System.Windows.Forms.Button
Friend WithEvents lblMremoteXMLOnly As System.Windows.Forms.Label
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Private Sub InitializeComponent()
Dim ListViewItem1 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("Username")
Dim ListViewItem2 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("Password")
Dim ListViewItem3 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("Domain")
Dim ListViewItem4 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem("Inheritance")
Me.btnCancel = New System.Windows.Forms.Button
Me.btnOK = New System.Windows.Forms.Button
Me.lvSecurity = New System.Windows.Forms.ListView
Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader
Me.Label1 = New System.Windows.Forms.Label
Me.lblMremoteXMLOnly = New System.Windows.Forms.Label
Me.PictureBox1 = New System.Windows.Forms.PictureBox
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'btnCancel
'
Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnCancel.Location = New System.Drawing.Point(457, 370)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 110
Me.btnCancel.Text = "&Cancel"
Me.btnCancel.UseVisualStyleBackColor = True
'
'btnOK
'
Me.btnOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnOK.Location = New System.Drawing.Point(376, 370)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(75, 23)
Me.btnOK.TabIndex = 100
Me.btnOK.Text = "&OK"
Me.btnOK.UseVisualStyleBackColor = True
'
'lvSecurity
'
Me.lvSecurity.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lvSecurity.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.lvSecurity.CheckBoxes = True
Me.lvSecurity.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1})
Me.lvSecurity.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None
ListViewItem1.Checked = True
ListViewItem1.StateImageIndex = 1
ListViewItem2.Checked = True
ListViewItem2.StateImageIndex = 1
ListViewItem3.Checked = True
ListViewItem3.StateImageIndex = 1
ListViewItem4.Checked = True
ListViewItem4.StateImageIndex = 1
Me.lvSecurity.Items.AddRange(New System.Windows.Forms.ListViewItem() {ListViewItem1, ListViewItem2, ListViewItem3, ListViewItem4})
Me.lvSecurity.Location = New System.Drawing.Point(0, 55)
Me.lvSecurity.MultiSelect = False
Me.lvSecurity.Name = "lvSecurity"
Me.lvSecurity.Scrollable = False
Me.lvSecurity.Size = New System.Drawing.Size(532, 309)
Me.lvSecurity.TabIndex = 20
Me.lvSecurity.UseCompatibleStateImageBehavior = False
Me.lvSecurity.View = System.Windows.Forms.View.Details
'
'ColumnHeader1
'
Me.ColumnHeader1.Width = 110
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 11)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(244, 13)
Me.Label1.TabIndex = 10
Me.Label1.Text = "Uncheck the properties you want not to be saved!"
'
'lblMremoteXMLOnly
'
Me.lblMremoteXMLOnly.AutoSize = True
Me.lblMremoteXMLOnly.ForeColor = System.Drawing.Color.DarkRed
Me.lblMremoteXMLOnly.Location = New System.Drawing.Point(37, 33)
Me.lblMremoteXMLOnly.Name = "lblMremoteXMLOnly"
Me.lblMremoteXMLOnly.Size = New System.Drawing.Size(345, 13)
Me.lblMremoteXMLOnly.TabIndex = 111
Me.lblMremoteXMLOnly.Text = "(These properties will only be saved if you select a mRemote file format!)"
'
'PictureBox1
'
Me.PictureBox1.Image = Global.mRemoteNG.My.Resources.Resources.WarningSmall
Me.PictureBox1.Location = New System.Drawing.Point(15, 31)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(16, 16)
Me.PictureBox1.TabIndex = 112
Me.PictureBox1.TabStop = False
'
'Export
'
Me.AcceptButton = Me.btnOK
Me.CancelButton = Me.btnCancel
Me.ClientSize = New System.Drawing.Size(534, 396)
Me.Controls.Add(Me.PictureBox1)
Me.Controls.Add(Me.lblMremoteXMLOnly)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.lvSecurity)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnOK)
Me.Icon = Global.mRemoteNG.My.Resources.Resources.Connections_SaveAs_Icon
Me.Name = "Export"
Me.TabText = "Export Connections"
Me.Text = "Export Connections"
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
#Region "Public Properties"
Private _treeNode As TreeNode
Public Property TreeNode() As TreeNode
Get
Return _treeNode
End Get
Set(ByVal value As TreeNode)
_treeNode = value
End Set
End Property
#End Region
#Region "Public Methods"
Public Sub New(ByVal panel As DockContent)
Me.New(panel, Nothing)
End Sub
Public Sub New(ByVal panel As DockContent, ByVal treeNode As TreeNode)
WindowType = Type.Export
DockPnl = panel
InitializeComponent()
_treeNode = treeNode
End Sub
#End Region
#Region "Form Stuff"
Private Sub Export_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ApplyLanguage()
End Sub
Private Sub ApplyLanguage()
lvSecurity.Items(0).Text = My.Language.strCheckboxUsername
lvSecurity.Items(1).Text = My.Language.strCheckboxPassword
lvSecurity.Items(2).Text = My.Language.strCheckboxDomain
lvSecurity.Items(3).Text = My.Language.strCheckboxInheritance
btnCancel.Text = My.Language.strButtonCancel
btnOK.Text = My.Language.strButtonOK
Label1.Text = My.Language.strUncheckProperties
lblMremoteXMLOnly.Text = My.Language.strPropertiesWillOnlyBeSavedMRemoteXML
TabText = My.Language.strExport
Text = My.Language.strExport
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Try
If _treeNode Is Nothing Then
_treeNode = Windows.treeForm.tvConnections.Nodes(0)
End If
Dim saveSecurity As New Security.Save()
saveSecurity.Username = lvSecurity.Items(0).Checked
saveSecurity.Password = lvSecurity.Items(1).Checked
saveSecurity.Domain = lvSecurity.Items(2).Checked
saveSecurity.Inheritance = lvSecurity.Items(3).Checked
SaveConnectionsAs(_treeNode, saveSecurity)
Close()
Catch ex As Exception
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "UI.Window.Export.btnOK_Click() failed" & vbNewLine & ex.Message, True)
End Try
End Sub
#End Region
End Class
End Namespace
End Namespace