diff --git a/mRemoteV1/App/App.Runtime.vb b/mRemoteV1/App/App.Runtime.vb index f9a6a9325..8ecc3ca74 100644 --- a/mRemoteV1/App/App.Runtime.vb +++ b/mRemoteV1/App/App.Runtime.vb @@ -1527,7 +1527,7 @@ Namespace App End Sub Public Shared Sub SaveConnectionsAs(Optional ByVal rootNode As TreeNode = Nothing, Optional ByVal saveSecurity As Security.Save = Nothing) - Dim connectionsSave As New Config.Connections.Save + Dim connectionsSave As New Connections.Save Dim previousTimerState As Boolean = False Try @@ -1546,23 +1546,21 @@ Namespace App saveAsDialog = Tools.Controls.ConnectionsExportDialog End If - If saveAsDialog.ShowDialog = System.Windows.Forms.DialogResult.OK Then - connectionsSave.ConnectionFileName = saveAsDialog.FileName - Else - Exit Sub - End If + If Not saveAsDialog.ShowDialog() = DialogResult.OK Then Return + + connectionsSave.ConnectionFileName = saveAsDialog.FileName If export Then Select Case saveAsDialog.FilterIndex Case 1 - connectionsSave.SaveFormat = Config.Connections.Save.Format.mRXML + connectionsSave.SaveFormat = Connections.Save.Format.mRXML Case 2 - connectionsSave.SaveFormat = Config.Connections.Save.Format.mRCSV + connectionsSave.SaveFormat = Connections.Save.Format.mRCSV Case 3 - connectionsSave.SaveFormat = Config.Connections.Save.Format.vRDCSV + connectionsSave.SaveFormat = Connections.Save.Format.vRDCSV End Select Else - connectionsSave.SaveFormat = Config.Connections.Save.Format.mRXML + connectionsSave.SaveFormat = Connections.Save.Format.mRXML If connectionsSave.ConnectionFileName = GetDefaultStartupConnectionFileName() Then My.Settings.LoadConsFromCustomLocation = False @@ -1583,7 +1581,7 @@ Namespace App connectionsSave.Save() Catch ex As Exception - MessageCollector.AddMessage(MessageClass.ErrorMsg, String.Format(My.Language.strConnectionsFileCouldNotSaveAs, connectionsSave.ConnectionFileName) & vbNewLine & ex.Message) + MessageCollector.AddExceptionMessage(String.Format(My.Language.strConnectionsFileCouldNotSaveAs, connectionsSave.ConnectionFileName), ex) Finally If TimerSqlWatcher IsNot Nothing Then TimerSqlWatcher.Enabled = previousTimerState diff --git a/mRemoteV1/UI/UI.Window.Export.Designer.vb b/mRemoteV1/UI/UI.Window.Export.Designer.vb new file mode 100644 index 000000000..206f92962 --- /dev/null +++ b/mRemoteV1/UI/UI.Window.Export.Designer.vb @@ -0,0 +1,135 @@ +Namespace UI + Namespace Window + Public Partial Class Export + Inherits Base +#Region " Windows Form Designer generated code " + 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 lblUncheckProperties 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 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.lblUncheckProperties = 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 = 4 + 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 = 3 + 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 = 2 + Me.lvSecurity.UseCompatibleStateImageBehavior = False + Me.lvSecurity.View = System.Windows.Forms.View.Details + ' + 'ColumnHeader1 + ' + Me.ColumnHeader1.Width = 110 + ' + 'Label1 + ' + Me.lblUncheckProperties.AutoSize = True + Me.lblUncheckProperties.Location = New System.Drawing.Point(12, 11) + Me.lblUncheckProperties.Name = "lblUncheckProperties" + Me.lblUncheckProperties.Size = New System.Drawing.Size(244, 13) + Me.lblUncheckProperties.TabIndex = 0 + Me.lblUncheckProperties.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 = 1 + 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.lblUncheckProperties) + Me.Controls.Add(Me.lvSecurity) + Me.Controls.Add(Me.btnCancel) + Me.Controls.Add(Me.btnOK) + Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + 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 + End Class + End Namespace +End Namespace diff --git a/mRemoteV1/UI/UI.Window.Export.vb b/mRemoteV1/UI/UI.Window.Export.vb index 43d1a41f0..2376fca74 100644 --- a/mRemoteV1/UI/UI.Window.Export.vb +++ b/mRemoteV1/UI/UI.Window.Export.vb @@ -4,189 +4,35 @@ 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 - + Inherits Base #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 +#Region "Constructors" + Public Sub New(ByVal panel As DockContent, Optional ByVal treeNode As TreeNode = Nothing) InitializeComponent() - _treeNode = treeNode + WindowType = Type.Export + DockPnl = panel + + Me.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 +#Region "Private Methods" +#Region "Event Handlers" + Private Sub Export_Load(ByVal sender As Object, ByVal e As 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 + Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnCancel.Click + Close() 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 + Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnOK.Click Try - If _treeNode Is Nothing Then - _treeNode = Windows.treeForm.tvConnections.Nodes(0) - End If + If TreeNode Is Nothing Then TreeNode = Windows.treeForm.tvConnections.Nodes(0) Dim saveSecurity As New Security.Save() @@ -195,14 +41,32 @@ Namespace UI saveSecurity.Domain = lvSecurity.Items(2).Checked saveSecurity.Inheritance = lvSecurity.Items(3).Checked - SaveConnectionsAs(_treeNode, saveSecurity) + SaveConnectionsAs(TreeNode, saveSecurity) + Close() Catch ex As Exception - MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "UI.Window.Export.btnOK_Click() failed" & vbNewLine & ex.Message, True) + MessageCollector.AddExceptionMessage("UI.Window.Export.btnOK_Click() failed.", ex, , True) End Try End Sub #End Region + Private Sub ApplyLanguage() + Text = My.Language.strExport + TabText = My.Language.strExport + + lblUncheckProperties.Text = My.Language.strUncheckProperties + lblMremoteXMLOnly.Text = My.Language.strPropertiesWillOnlyBeSavedMRemoteXML + + 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 + + btnOK.Text = My.Language.strButtonOK + btnCancel.Text = My.Language.strButtonCancel + End Sub +#End Region + End Class End Namespace End Namespace \ No newline at end of file diff --git a/mRemoteV1/mRemoteV1.vbproj b/mRemoteV1/mRemoteV1.vbproj index 02389cd72..d9333f4be 100644 --- a/mRemoteV1/mRemoteV1.vbproj +++ b/mRemoteV1/mRemoteV1.vbproj @@ -400,6 +400,9 @@ Form + + UI.Window.Export.vb + Form