From b27f3c44caa34254a170d2bac78793b4dd34b859 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Wed, 9 Oct 2024 14:23:44 +0300 Subject: [PATCH 1/6] changes to the code --- instat/dlgExportToClimsoft.Designer.vb | 152 +++++++++++++++++++------ instat/dlgExportToClimsoft.vb | 150 ++++++++++++++++++------ 2 files changed, 234 insertions(+), 68 deletions(-) diff --git a/instat/dlgExportToClimsoft.Designer.vb b/instat/dlgExportToClimsoft.Designer.vb index 936d119bb8..0c53cfe53b 100644 --- a/instat/dlgExportToClimsoft.Designer.vb +++ b/instat/dlgExportToClimsoft.Designer.vb @@ -27,10 +27,8 @@ Partial Class dlgExportToClimsoft Me.lblHour = New System.Windows.Forms.Label() Me.lblExport = New System.Windows.Forms.Label() Me.cmdBrowse = New System.Windows.Forms.Button() - Me.ucrChkExportDataFrame = New instat.ucrCheck() Me.ucrInputExportFile = New instat.ucrInputTextBox() Me.ucrSaveNewDataFrame = New instat.ucrSave() - Me.ucrChkNewDataFrame = New instat.ucrCheck() Me.ucrInputHour = New instat.ucrInputTextBox() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverElements = New instat.ucrReceiverMultiple() @@ -41,6 +39,14 @@ Partial Class dlgExportToClimsoft Me.ucrPnlDailyHourly = New instat.UcrPanel() Me.ucrReceiverStationID = New instat.ucrReceiverSingle() Me.lblStationID = New System.Windows.Forms.Label() + Me.rdoExportData = New System.Windows.Forms.RadioButton() + Me.rdoNewDataFrame = New System.Windows.Forms.RadioButton() + Me.ucrReceiverComments = New instat.ucrReceiverSingle() + Me.ucrChkAddReport = New instat.ucrCheck() + Me.lblcomments = New System.Windows.Forms.Label() + Me.ucrDataFrameSheets = New instat.ucrDataFrame() + Me.ucrPnlOutput = New instat.UcrPanel() + Me.grpSave = New System.Windows.Forms.GroupBox() Me.SuspendLayout() ' 'lblElement @@ -77,7 +83,7 @@ Partial Class dlgExportToClimsoft ' Me.lblExport.AutoSize = True Me.lblExport.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblExport.Location = New System.Drawing.Point(14, 566) + Me.lblExport.Location = New System.Drawing.Point(14, 654) Me.lblExport.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblExport.Name = "lblExport" Me.lblExport.Size = New System.Drawing.Size(88, 20) @@ -87,7 +93,7 @@ Partial Class dlgExportToClimsoft 'cmdBrowse ' Me.cmdBrowse.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdBrowse.Location = New System.Drawing.Point(489, 558) + Me.cmdBrowse.Location = New System.Drawing.Point(489, 646) Me.cmdBrowse.Margin = New System.Windows.Forms.Padding(4) Me.cmdBrowse.Name = "cmdBrowse" Me.cmdBrowse.Size = New System.Drawing.Size(120, 34) @@ -95,23 +101,13 @@ Partial Class dlgExportToClimsoft Me.cmdBrowse.Text = "Browse" Me.cmdBrowse.UseVisualStyleBackColor = True ' - 'ucrChkExportDataFrame - ' - Me.ucrChkExportDataFrame.AutoSize = True - Me.ucrChkExportDataFrame.Checked = False - Me.ucrChkExportDataFrame.Location = New System.Drawing.Point(14, 459) - Me.ucrChkExportDataFrame.Margin = New System.Windows.Forms.Padding(9) - Me.ucrChkExportDataFrame.Name = "ucrChkExportDataFrame" - Me.ucrChkExportDataFrame.Size = New System.Drawing.Size(399, 34) - Me.ucrChkExportDataFrame.TabIndex = 13 - ' 'ucrInputExportFile ' Me.ucrInputExportFile.AddQuotesIfUnrecognised = True Me.ucrInputExportFile.AutoSize = True Me.ucrInputExportFile.IsMultiline = False Me.ucrInputExportFile.IsReadOnly = False - Me.ucrInputExportFile.Location = New System.Drawing.Point(213, 560) + Me.ucrInputExportFile.Location = New System.Drawing.Point(213, 648) Me.ucrInputExportFile.Margin = New System.Windows.Forms.Padding(9, 12, 9, 12) Me.ucrInputExportFile.Name = "ucrInputExportFile" Me.ucrInputExportFile.Size = New System.Drawing.Size(273, 32) @@ -120,22 +116,12 @@ Partial Class dlgExportToClimsoft 'ucrSaveNewDataFrame ' Me.ucrSaveNewDataFrame.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(14, 513) + Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(14, 604) Me.ucrSaveNewDataFrame.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) Me.ucrSaveNewDataFrame.Name = "ucrSaveNewDataFrame" Me.ucrSaveNewDataFrame.Size = New System.Drawing.Size(522, 36) Me.ucrSaveNewDataFrame.TabIndex = 14 ' - 'ucrChkNewDataFrame - ' - Me.ucrChkNewDataFrame.AutoSize = True - Me.ucrChkNewDataFrame.Checked = False - Me.ucrChkNewDataFrame.Location = New System.Drawing.Point(14, 416) - Me.ucrChkNewDataFrame.Margin = New System.Windows.Forms.Padding(9) - Me.ucrChkNewDataFrame.Name = "ucrChkNewDataFrame" - Me.ucrChkNewDataFrame.Size = New System.Drawing.Size(399, 34) - Me.ucrChkNewDataFrame.TabIndex = 12 - ' 'ucrInputHour ' Me.ucrInputHour.AddQuotesIfUnrecognised = True @@ -152,7 +138,7 @@ Partial Class dlgExportToClimsoft ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 604) + Me.ucrBase.Location = New System.Drawing.Point(10, 688) Me.ucrBase.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(611, 77) @@ -269,22 +255,118 @@ Partial Class dlgExportToClimsoft Me.lblStationID.TabIndex = 4 Me.lblStationID.Text = "Station ID:" ' + 'rdoExportData + ' + Me.rdoExportData.AutoSize = True + Me.rdoExportData.Location = New System.Drawing.Point(22, 421) + Me.rdoExportData.Margin = New System.Windows.Forms.Padding(4) + Me.rdoExportData.Name = "rdoExportData" + Me.rdoExportData.Size = New System.Drawing.Size(156, 24) + Me.rdoExportData.TabIndex = 94 + Me.rdoExportData.TabStop = True + Me.rdoExportData.Text = "Export Data (csv)" + Me.rdoExportData.UseVisualStyleBackColor = True + ' + 'rdoNewDataFrame + ' + Me.rdoNewDataFrame.AutoSize = True + Me.rdoNewDataFrame.Location = New System.Drawing.Point(22, 378) + Me.rdoNewDataFrame.Margin = New System.Windows.Forms.Padding(4) + Me.rdoNewDataFrame.Name = "rdoNewDataFrame" + Me.rdoNewDataFrame.Size = New System.Drawing.Size(154, 24) + Me.rdoNewDataFrame.TabIndex = 93 + Me.rdoNewDataFrame.TabStop = True + Me.rdoNewDataFrame.Text = "New Data Frame" + Me.rdoNewDataFrame.UseVisualStyleBackColor = True + ' + 'ucrReceiverComments + ' + Me.ucrReceiverComments.AutoSize = True + Me.ucrReceiverComments.frmParent = Me + Me.ucrReceiverComments.Location = New System.Drawing.Point(427, 557) + Me.ucrReceiverComments.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverComments.Name = "ucrReceiverComments" + Me.ucrReceiverComments.Selector = Nothing + Me.ucrReceiverComments.Size = New System.Drawing.Size(180, 30) + Me.ucrReceiverComments.strNcFilePath = "" + Me.ucrReceiverComments.TabIndex = 92 + Me.ucrReceiverComments.ucrSelector = Nothing + ' + 'ucrChkAddReport + ' + Me.ucrChkAddReport.AutoSize = True + Me.ucrChkAddReport.Checked = False + Me.ucrChkAddReport.Location = New System.Drawing.Point(8, 483) + Me.ucrChkAddReport.Margin = New System.Windows.Forms.Padding(9) + Me.ucrChkAddReport.Name = "ucrChkAddReport" + Me.ucrChkAddReport.Size = New System.Drawing.Size(315, 34) + Me.ucrChkAddReport.TabIndex = 91 + ' + 'lblcomments + ' + Me.lblcomments.AutoSize = True + Me.lblcomments.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblcomments.Location = New System.Drawing.Point(427, 531) + Me.lblcomments.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblcomments.Name = "lblcomments" + Me.lblcomments.Size = New System.Drawing.Size(90, 20) + Me.lblcomments.TabIndex = 90 + Me.lblcomments.Tag = "New_Name" + Me.lblcomments.Text = "Comments:" + ' + 'ucrDataFrameSheets + ' + Me.ucrDataFrameSheets.AutoSize = True + Me.ucrDataFrameSheets.bDropUnusedFilterLevels = False + Me.ucrDataFrameSheets.bUseCurrentFilter = True + Me.ucrDataFrameSheets.Location = New System.Drawing.Point(17, 524) + Me.ucrDataFrameSheets.Margin = New System.Windows.Forms.Padding(0) + Me.ucrDataFrameSheets.Name = "ucrDataFrameSheets" + Me.ucrDataFrameSheets.Size = New System.Drawing.Size(226, 75) + Me.ucrDataFrameSheets.TabIndex = 89 + ' + 'ucrPnlOutput + ' + Me.ucrPnlOutput.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlOutput.Location = New System.Drawing.Point(18, 377) + Me.ucrPnlOutput.Margin = New System.Windows.Forms.Padding(9) + Me.ucrPnlOutput.Name = "ucrPnlOutput" + Me.ucrPnlOutput.Size = New System.Drawing.Size(226, 90) + Me.ucrPnlOutput.TabIndex = 95 + ' + 'grpSave + ' + Me.grpSave.Location = New System.Drawing.Point(12, 356) + Me.grpSave.Margin = New System.Windows.Forms.Padding(4) + Me.grpSave.Name = "grpSave" + Me.grpSave.Padding = New System.Windows.Forms.Padding(4) + Me.grpSave.Size = New System.Drawing.Size(248, 110) + Me.grpSave.TabIndex = 96 + Me.grpSave.TabStop = False + Me.grpSave.Text = "Save" + ' 'dlgExportToClimsoft ' Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(626, 690) + Me.ClientSize = New System.Drawing.Size(626, 775) + Me.Controls.Add(Me.rdoExportData) + Me.Controls.Add(Me.rdoNewDataFrame) + Me.Controls.Add(Me.ucrReceiverComments) + Me.Controls.Add(Me.ucrChkAddReport) + Me.Controls.Add(Me.lblcomments) + Me.Controls.Add(Me.ucrDataFrameSheets) + Me.Controls.Add(Me.ucrPnlOutput) + Me.Controls.Add(Me.grpSave) Me.Controls.Add(Me.lblStationID) Me.Controls.Add(Me.ucrReceiverStationID) Me.Controls.Add(Me.rdoDaily) Me.Controls.Add(Me.rdoHourly) - Me.Controls.Add(Me.ucrChkExportDataFrame) Me.Controls.Add(Me.lblExport) Me.Controls.Add(Me.cmdBrowse) Me.Controls.Add(Me.ucrInputExportFile) Me.Controls.Add(Me.ucrSaveNewDataFrame) - Me.Controls.Add(Me.ucrChkNewDataFrame) Me.Controls.Add(Me.lblHour) Me.Controls.Add(Me.ucrInputHour) Me.Controls.Add(Me.ucrBase) @@ -312,15 +394,21 @@ Partial Class dlgExportToClimsoft Friend WithEvents ucrBase As ucrButtons Friend WithEvents lblHour As Label Friend WithEvents ucrInputHour As ucrInputTextBox - Friend WithEvents ucrChkNewDataFrame As ucrCheck Friend WithEvents ucrSaveNewDataFrame As ucrSave Friend WithEvents lblExport As Label Friend WithEvents cmdBrowse As Button Friend WithEvents ucrInputExportFile As ucrInputTextBox - Friend WithEvents ucrChkExportDataFrame As ucrCheck Friend WithEvents rdoDaily As RadioButton Friend WithEvents rdoHourly As RadioButton Friend WithEvents ucrPnlDailyHourly As UcrPanel Friend WithEvents lblStationID As Label Friend WithEvents ucrReceiverStationID As ucrReceiverSingle + Friend WithEvents rdoExportData As RadioButton + Friend WithEvents rdoNewDataFrame As RadioButton + Friend WithEvents ucrReceiverComments As ucrReceiverSingle + Friend WithEvents ucrChkAddReport As ucrCheck + Friend WithEvents lblcomments As Label + Friend WithEvents ucrDataFrameSheets As ucrDataFrame + Friend WithEvents ucrPnlOutput As UcrPanel + Friend WithEvents grpSave As GroupBox End Class diff --git a/instat/dlgExportToClimsoft.vb b/instat/dlgExportToClimsoft.vb index 887d4aa091..69215091fc 100644 --- a/instat/dlgExportToClimsoft.vb +++ b/instat/dlgExportToClimsoft.vb @@ -20,7 +20,7 @@ Imports instat.Translations Public Class dlgExportToClimsoft Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsDataFrameFunction, clsCurrentNewColumnFunction, clsDummyFunction, clsMutateFunction, clsExportClimsoftFunction, clsPasteFunction, clsSprintfFunction, clsPosixctFunction As New RFunction + Private clsDataFrameFunction, clsCurrentNewColumnFunction, clsDummyFunction, clsMutateFunction, clsExportClimsoftFunction, clsPasteFunction, clsSprintfFunction, clsPosixctFunction, clsExportCommentsFunction As New RFunction Private clsPipeOperator As New ROperator Private Sub dlgExportToClimsoft_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -44,6 +44,26 @@ Public Class dlgExportToClimsoft ucrReceiverStationID.SetLinkedDisplayControl(lblStationID) ucrReceiverStationID.Selector = ucrSelectorImportToClimsoft + ucrDataFrameSheets.SetParameter(New RParameter("data_name", 0)) + ucrDataFrameSheets.SetParameterIsString() + + ucrReceiverComments.SetParameter(New RParameter("x", 1)) + ucrReceiverComments.SetParameterIsRFunction() + ucrReceiverComments.SetItemType("dataframe") + + ucrReceiverComments.SetLinkedDisplayControl(lblcomments) + + ucrPnlOutput.AddRadioButton(rdoNewDataFrame) + ucrPnlOutput.AddRadioButton(rdoExportData) + + ucrPnlOutput.AddParameterValuesCondition(rdoNewDataFrame, "check", "dataframe") + ucrPnlOutput.AddParameterValuesCondition(rdoExportData, "check", "export") + + ucrChkAddReport.SetText("Add Reports") + ucrChkAddReport.AddToLinkedControls({ucrReceiverComments, ucrDataFrameSheets, ucrInputExportFile}, {True}, bNewLinkedHideIfParameterMissing:=True) + ucrChkAddReport.AddParameterValuesCondition(True, "comments", "True") + ucrChkAddReport.AddParameterValuesCondition(False, "comments", "False") + ucrReceiverDate.SetParameter(New RParameter("date", 2)) ucrReceiverDate.SetParameterIsRFunction() ucrReceiverDate.SetClimaticType("date") @@ -64,16 +84,6 @@ Public Class dlgExportToClimsoft ucrReceiverElements.SetLinkedDisplayControl(lblElement) ucrReceiverElements.Selector = ucrSelectorImportToClimsoft - ucrChkNewDataFrame.SetText("New Data Frame Name") - ucrChkNewDataFrame.AddToLinkedControls(ucrSaveNewDataFrame, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrChkNewDataFrame.AddParameterValuesCondition(True, "dataframe", "True") - ucrChkNewDataFrame.AddParameterValuesCondition(False, "dataframe", "False") - - ucrChkExportDataFrame.SetText(" Export Data Frame(s)") - ucrChkExportDataFrame.AddToLinkedControls(ucrInputExportFile, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrChkExportDataFrame.AddParameterValuesCondition(True, "export", "True") - ucrChkExportDataFrame.AddParameterValuesCondition(False, "export", "False") - ucrSaveNewDataFrame.SetSaveTypeAsDataFrame() ucrSaveNewDataFrame.SetIsTextBox() ucrSaveNewDataFrame.SetLabelText("Data Frame Name:") @@ -92,6 +102,7 @@ Public Class dlgExportToClimsoft clsExportClimsoftFunction = New RFunction clsPasteFunction = New RFunction clsSprintfFunction = New RFunction + clsExportCommentsFunction = New RFunction clsPipeOperator = New ROperator ucrSelectorImportToClimsoft.Reset() @@ -101,6 +112,8 @@ Public Class dlgExportToClimsoft clsDummyFunction.AddParameter("dataframe", "True", iPosition:=0) clsDummyFunction.AddParameter("export", "False", iPosition:=1) clsDummyFunction.AddParameter("checked", "daily", iPosition:=2) + clsDummyFunction.AddParameter("value", "True", iPosition:=3) + clsDummyFunction.AddParameter("check", "dataframe", iPosition:=4) clsPosixctFunction.SetRCommand("as.POSIXct") clsPosixctFunction.AddParameter("x", clsRFunctionParameter:=clsPasteFunction, bIncludeArgumentName:=False, iPosition:=0) @@ -126,6 +139,9 @@ Public Class dlgExportToClimsoft clsSprintfFunction.SetRCommand("sprintf") clsSprintfFunction.AddParameter("hour", 6, iPosition:=1, bIncludeArgumentName:=False) + clsExportCommentsFunction.SetPackageName("rio") + clsExportCommentsFunction.SetRCommand("export") + ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) ucrBase.clsRsyntax.AddToBeforeCodes(clsCurrentNewColumnFunction, iPosition:=0) @@ -135,6 +151,8 @@ Public Class dlgExportToClimsoft End Sub Private Sub SetRCodeForControls(bReset As Boolean) + ucrInputExportFile.AddAdditionalCodeParameterPair(clsExportCommentsFunction, New RParameter("file", 0), iAdditionalPairNo:=1) + ucrReceiverDate.SetRCode(clsPasteFunction, bReset) ucrInputHour.SetRCode(clsSprintfFunction, bReset) ucrReceiverStationID.SetRCode(clsDataFrameFunction, bReset) @@ -142,21 +160,32 @@ Public Class dlgExportToClimsoft ucrInputExportFile.SetRCode(clsExportClimsoftFunction, bReset) ucrPnlDailyHourly.SetRCode(clsDummyFunction, bReset) If bReset Then - ucrChkExportDataFrame.SetRCode(clsDummyFunction, bReset) - ucrChkNewDataFrame.SetRCode(clsDummyFunction, bReset) + ucrPnlOutput.SetRCode(clsDummyFunction, bReset) + ucrChkAddReport.SetRCode(clsDummyFunction, bReset) + ucrReceiverComments.SetRCode(clsExportCommentsFunction, bReset) End If End Sub Private Sub TestOkEnabled() - ucrBase.OKEnabled(Not ucrReceiverDate.IsEmpty _ - AndAlso Not ucrReceiverElements.IsEmpty _ - AndAlso Not ucrReceiverStationID.IsEmpty - ) - If ucrChkNewDataFrame.Checked And Not ucrSaveNewDataFrame.IsComplete Then - ucrBase.OKEnabled(False) - End If - If ucrChkExportDataFrame.Checked And ucrInputExportFile.IsEmpty Then - ucrBase.OKEnabled(False) + + If rdoNewDataFrame.Checked Then + If Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverElements.IsEmpty AndAlso ucrSaveNewDataFrame.IsComplete Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + ElseIf rdoExportData.Checked Then + If Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverElements.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + ElseIf ucrChkAddReport.Checked And rdoExportData.Checked Then + If Not ucrReceiverComments.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End If End Sub @@ -181,10 +210,6 @@ Public Class dlgExportToClimsoft DataFrameAssignTo() End Sub - Private Sub ucrChkNewDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNewDataFrame.ControlValueChanged, ucrChkExportDataFrame.ControlValueChanged - SettingBaseFunction() - End Sub - Private Sub ucrReceiverElements_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElements.ControlValueChanged ucrBase.clsRsyntax.GetBeforeCodes().Clear() clsCurrentNewColumnFunction = ucrReceiverElements.GetVariables(True).Clone @@ -198,25 +223,38 @@ Public Class dlgExportToClimsoft End Sub Private Sub SettingBaseFunction() + cmdBrowse.Visible = False - If ucrChkNewDataFrame.Checked And ucrChkExportDataFrame.Checked Then - ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) - ucrBase.clsRsyntax.ClearCodes() - ucrBase.clsRsyntax.AddToBeforeCodes(clsCurrentNewColumnFunction) - ucrBase.clsRsyntax.AddToAfterCodes(clsExportClimsoftFunction) - cmdBrowse.Visible = True - ElseIf ucrChkNewDataFrame.Checked AndAlso Not ucrChkExportDataFrame.Checked Then + If rdoNewDataFrame.Checked Then ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) ucrBase.clsRsyntax.GetAfterCodes().Clear() cmdBrowse.Visible = False + ucrInputExportFile.Visible = False - ElseIf ucrChkExportDataFrame.Checked AndAlso Not ucrChkNewDataFrame.Checked Then - ucrBase.clsRsyntax.GetBeforeCodes().Clear() + Else + ucrBase.clsRsyntax.GetAfterCodes().Clear() ucrBase.clsRsyntax.AddToBeforeCodes(clsCurrentNewColumnFunction) ucrBase.clsRsyntax.SetBaseRFunction(clsExportClimsoftFunction) ucrBase.clsRsyntax.GetAfterCodes().Clear() cmdBrowse.Visible = True + ucrInputExportFile.Visible = True + End If + + If ucrChkAddReport.Checked AndAlso rdoExportData.Checked Then + ucrBase.clsRsyntax.ClearCodes() + ucrBase.clsRsyntax.SetBaseRFunction(clsExportCommentsFunction) + cmdBrowse.Visible = True + ucrInputExportFile.Visible = True + End If + End Sub + + Private Sub AddingComments() + If ucrDataFrameSheets.cboAvailableDataFrames.Text = ".comment" Then + ucrReceiverComments.SetText(ucrDataFrameSheets.cboAvailableDataFrames.Text) + Else + ucrReceiverComments.SetText("") End If + End Sub Private Sub SelectFileToSave() @@ -235,9 +273,19 @@ Public Class dlgExportToClimsoft End Using End Sub + Private Sub EnableDisableComments() + If rdoExportData.Checked Then + ucrChkAddReport.Enabled = True + Else + ucrChkAddReport.Enabled = False + ucrChkAddReport.Checked = False + End If + + End Sub + Private Sub ucrReceiverElements_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElements.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrSaveNewDataFrame.ControlContentsChanged, - ucrReceiverStationID.ControlContentsChanged, ucrInputExportFile.ControlContentsChanged, ucrChkExportDataFrame.ControlContentsChanged + ucrReceiverStationID.ControlContentsChanged, ucrInputExportFile.ControlContentsChanged TestOkEnabled() End Sub @@ -246,6 +294,26 @@ Public Class dlgExportToClimsoft SelectFileToSave() End If SettingBaseFunction() + EnableDisableComments() + End Sub + + Private Sub ucrDataFrameSheets_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataFrameSheets.ControlValueChanged + AddingComments() + End Sub + + Private Sub ucrReceiverComments_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverComments.ControlValueChanged + clsExportCommentsFunction.AddParameter("x", clsRFunctionParameter:=ucrDataFrameSheets.clsCurrDataFrame, iPosition:=1) + SettingBaseFunction() + End Sub + + Private Sub ucrChkAddReport_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddReport.ControlValueChanged + AddingComments() + If ucrChkAddReport.Checked Then + ucrInputExportFile.SetName("") + End If + SettingBaseFunction() + EnableDisableComments() + End Sub Private Sub ucrInputHour_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputHour.ControlValueChanged @@ -267,4 +335,14 @@ Public Class dlgExportToClimsoft clsPasteFunction.RemoveParameterByName("date_time") End If End Sub + + Private Sub ucrInputExportFile_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputExportFile.ControlValueChanged + EnableDisableComments() + End Sub + + Private Sub ucrPnlOutput_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOutput.ControlValueChanged + EnableDisableComments() + SettingBaseFunction() + End Sub + End Class \ No newline at end of file From da352f4e679741d878eb64ff96bad2af65a44d44 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Mon, 14 Oct 2024 13:37:57 +0300 Subject: [PATCH 2/6] changes in the code --- instat/dlgExportToClimsoft.Designer.vb | 154 +++++++++---------------- instat/dlgExportToClimsoft.vb | 62 +++++----- 2 files changed, 86 insertions(+), 130 deletions(-) diff --git a/instat/dlgExportToClimsoft.Designer.vb b/instat/dlgExportToClimsoft.Designer.vb index 0c53cfe53b..73783bb0ca 100644 --- a/instat/dlgExportToClimsoft.Designer.vb +++ b/instat/dlgExportToClimsoft.Designer.vb @@ -41,9 +41,7 @@ Partial Class dlgExportToClimsoft Me.lblStationID = New System.Windows.Forms.Label() Me.rdoExportData = New System.Windows.Forms.RadioButton() Me.rdoNewDataFrame = New System.Windows.Forms.RadioButton() - Me.ucrReceiverComments = New instat.ucrReceiverSingle() Me.ucrChkAddReport = New instat.ucrCheck() - Me.lblcomments = New System.Windows.Forms.Label() Me.ucrDataFrameSheets = New instat.ucrDataFrame() Me.ucrPnlOutput = New instat.UcrPanel() Me.grpSave = New System.Windows.Forms.GroupBox() @@ -52,30 +50,27 @@ Partial Class dlgExportToClimsoft 'lblElement ' Me.lblElement.AutoSize = True - Me.lblElement.Location = New System.Drawing.Point(417, 268) - Me.lblElement.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblElement.Location = New System.Drawing.Point(278, 179) Me.lblElement.Name = "lblElement" - Me.lblElement.Size = New System.Drawing.Size(80, 20) + Me.lblElement.Size = New System.Drawing.Size(53, 13) Me.lblElement.TabIndex = 10 Me.lblElement.Text = "Elements:" ' 'lblDate ' Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(417, 140) - Me.lblDate.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblDate.Location = New System.Drawing.Point(278, 93) Me.lblDate.Name = "lblDate" - Me.lblDate.Size = New System.Drawing.Size(48, 20) + Me.lblDate.Size = New System.Drawing.Size(33, 13) Me.lblDate.TabIndex = 6 Me.lblDate.Text = "Date:" ' 'lblHour ' Me.lblHour.AutoSize = True - Me.lblHour.Location = New System.Drawing.Point(417, 204) - Me.lblHour.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblHour.Location = New System.Drawing.Point(278, 136) Me.lblHour.Name = "lblHour" - Me.lblHour.Size = New System.Drawing.Size(48, 20) + Me.lblHour.Size = New System.Drawing.Size(33, 13) Me.lblHour.TabIndex = 8 Me.lblHour.Text = "Hour:" ' @@ -83,20 +78,18 @@ Partial Class dlgExportToClimsoft ' Me.lblExport.AutoSize = True Me.lblExport.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblExport.Location = New System.Drawing.Point(14, 654) - Me.lblExport.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblExport.Location = New System.Drawing.Point(9, 436) Me.lblExport.Name = "lblExport" - Me.lblExport.Size = New System.Drawing.Size(88, 20) + Me.lblExport.Size = New System.Drawing.Size(59, 13) Me.lblExport.TabIndex = 15 Me.lblExport.Text = "Export File:" ' 'cmdBrowse ' Me.cmdBrowse.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdBrowse.Location = New System.Drawing.Point(489, 646) - Me.cmdBrowse.Margin = New System.Windows.Forms.Padding(4) + Me.cmdBrowse.Location = New System.Drawing.Point(326, 431) Me.cmdBrowse.Name = "cmdBrowse" - Me.cmdBrowse.Size = New System.Drawing.Size(120, 34) + Me.cmdBrowse.Size = New System.Drawing.Size(80, 23) Me.cmdBrowse.TabIndex = 17 Me.cmdBrowse.Text = "Browse" Me.cmdBrowse.UseVisualStyleBackColor = True @@ -107,19 +100,19 @@ Partial Class dlgExportToClimsoft Me.ucrInputExportFile.AutoSize = True Me.ucrInputExportFile.IsMultiline = False Me.ucrInputExportFile.IsReadOnly = False - Me.ucrInputExportFile.Location = New System.Drawing.Point(213, 648) - Me.ucrInputExportFile.Margin = New System.Windows.Forms.Padding(9, 12, 9, 12) + Me.ucrInputExportFile.Location = New System.Drawing.Point(142, 432) + Me.ucrInputExportFile.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) Me.ucrInputExportFile.Name = "ucrInputExportFile" - Me.ucrInputExportFile.Size = New System.Drawing.Size(273, 32) + Me.ucrInputExportFile.Size = New System.Drawing.Size(182, 21) Me.ucrInputExportFile.TabIndex = 16 ' 'ucrSaveNewDataFrame ' Me.ucrSaveNewDataFrame.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(14, 604) - Me.ucrSaveNewDataFrame.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) + Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(9, 403) + Me.ucrSaveNewDataFrame.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveNewDataFrame.Name = "ucrSaveNewDataFrame" - Me.ucrSaveNewDataFrame.Size = New System.Drawing.Size(522, 36) + Me.ucrSaveNewDataFrame.Size = New System.Drawing.Size(348, 24) Me.ucrSaveNewDataFrame.TabIndex = 14 ' 'ucrInputHour @@ -128,31 +121,31 @@ Partial Class dlgExportToClimsoft Me.ucrInputHour.AutoSize = True Me.ucrInputHour.IsMultiline = False Me.ucrInputHour.IsReadOnly = False - Me.ucrInputHour.Location = New System.Drawing.Point(417, 230) - Me.ucrInputHour.Margin = New System.Windows.Forms.Padding(14) + Me.ucrInputHour.Location = New System.Drawing.Point(278, 153) + Me.ucrInputHour.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) Me.ucrInputHour.Name = "ucrInputHour" - Me.ucrInputHour.Size = New System.Drawing.Size(178, 32) + Me.ucrInputHour.Size = New System.Drawing.Size(119, 21) Me.ucrInputHour.TabIndex = 9 ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 688) - Me.ucrBase.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) + Me.ucrBase.Location = New System.Drawing.Point(7, 459) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(611, 77) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 18 ' 'ucrReceiverElements ' Me.ucrReceiverElements.AutoSize = True Me.ucrReceiverElements.frmParent = Me - Me.ucrReceiverElements.Location = New System.Drawing.Point(417, 298) + Me.ucrReceiverElements.Location = New System.Drawing.Point(278, 199) Me.ucrReceiverElements.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverElements.Name = "ucrReceiverElements" Me.ucrReceiverElements.Selector = Nothing - Me.ucrReceiverElements.Size = New System.Drawing.Size(180, 150) + Me.ucrReceiverElements.Size = New System.Drawing.Size(120, 100) Me.ucrReceiverElements.strNcFilePath = "" Me.ucrReceiverElements.TabIndex = 11 Me.ucrReceiverElements.ucrSelector = Nothing @@ -161,11 +154,11 @@ Partial Class dlgExportToClimsoft ' Me.ucrReceiverDate.AutoSize = True Me.ucrReceiverDate.frmParent = Me - Me.ucrReceiverDate.Location = New System.Drawing.Point(417, 165) + Me.ucrReceiverDate.Location = New System.Drawing.Point(278, 110) Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDate.Name = "ucrReceiverDate" Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.Size = New System.Drawing.Size(180, 30) + Me.ucrReceiverDate.Size = New System.Drawing.Size(120, 20) Me.ucrReceiverDate.strNcFilePath = "" Me.ucrReceiverDate.TabIndex = 7 Me.ucrReceiverDate.ucrSelector = Nothing @@ -176,10 +169,10 @@ Partial Class dlgExportToClimsoft Me.ucrSelectorImportToClimsoft.bDropUnusedFilterLevels = False Me.ucrSelectorImportToClimsoft.bShowHiddenColumns = False Me.ucrSelectorImportToClimsoft.bUseCurrentFilter = True - Me.ucrSelectorImportToClimsoft.Location = New System.Drawing.Point(14, 78) + Me.ucrSelectorImportToClimsoft.Location = New System.Drawing.Point(9, 52) Me.ucrSelectorImportToClimsoft.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorImportToClimsoft.Name = "ucrSelectorImportToClimsoft" - Me.ucrSelectorImportToClimsoft.Size = New System.Drawing.Size(320, 274) + Me.ucrSelectorImportToClimsoft.Size = New System.Drawing.Size(213, 183) Me.ucrSelectorImportToClimsoft.TabIndex = 3 ' 'rdoHourly @@ -192,10 +185,9 @@ Partial Class dlgExportToClimsoft Me.rdoHourly.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoHourly.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoHourly.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoHourly.Location = New System.Drawing.Point(285, 12) - Me.rdoHourly.Margin = New System.Windows.Forms.Padding(4) + Me.rdoHourly.Location = New System.Drawing.Point(190, 8) Me.rdoHourly.Name = "rdoHourly" - Me.rdoHourly.Size = New System.Drawing.Size(136, 42) + Me.rdoHourly.Size = New System.Drawing.Size(91, 28) Me.rdoHourly.TabIndex = 2 Me.rdoHourly.TabStop = True Me.rdoHourly.Tag = "Frequency" @@ -212,10 +204,9 @@ Partial Class dlgExportToClimsoft Me.rdoDaily.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoDaily.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoDaily.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoDaily.Location = New System.Drawing.Point(151, 12) - Me.rdoDaily.Margin = New System.Windows.Forms.Padding(4) + Me.rdoDaily.Location = New System.Drawing.Point(101, 8) Me.rdoDaily.Name = "rdoDaily" - Me.rdoDaily.Size = New System.Drawing.Size(136, 42) + Me.rdoDaily.Size = New System.Drawing.Size(91, 28) Me.rdoDaily.TabIndex = 1 Me.rdoDaily.TabStop = True Me.rdoDaily.Tag = "Frequency" @@ -226,21 +217,21 @@ Partial Class dlgExportToClimsoft 'ucrPnlDailyHourly ' Me.ucrPnlDailyHourly.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlDailyHourly.Location = New System.Drawing.Point(136, 12) - Me.ucrPnlDailyHourly.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) + Me.ucrPnlDailyHourly.Location = New System.Drawing.Point(91, 8) + Me.ucrPnlDailyHourly.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) Me.ucrPnlDailyHourly.Name = "ucrPnlDailyHourly" - Me.ucrPnlDailyHourly.Size = New System.Drawing.Size(310, 42) + Me.ucrPnlDailyHourly.Size = New System.Drawing.Size(207, 28) Me.ucrPnlDailyHourly.TabIndex = 0 ' 'ucrReceiverStationID ' Me.ucrReceiverStationID.AutoSize = True Me.ucrReceiverStationID.frmParent = Me - Me.ucrReceiverStationID.Location = New System.Drawing.Point(414, 110) + Me.ucrReceiverStationID.Location = New System.Drawing.Point(276, 73) Me.ucrReceiverStationID.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverStationID.Name = "ucrReceiverStationID" Me.ucrReceiverStationID.Selector = Nothing - Me.ucrReceiverStationID.Size = New System.Drawing.Size(180, 30) + Me.ucrReceiverStationID.Size = New System.Drawing.Size(120, 20) Me.ucrReceiverStationID.strNcFilePath = "" Me.ucrReceiverStationID.TabIndex = 5 Me.ucrReceiverStationID.ucrSelector = Nothing @@ -248,20 +239,18 @@ Partial Class dlgExportToClimsoft 'lblStationID ' Me.lblStationID.AutoSize = True - Me.lblStationID.Location = New System.Drawing.Point(419, 84) - Me.lblStationID.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblStationID.Location = New System.Drawing.Point(279, 56) Me.lblStationID.Name = "lblStationID" - Me.lblStationID.Size = New System.Drawing.Size(85, 20) + Me.lblStationID.Size = New System.Drawing.Size(57, 13) Me.lblStationID.TabIndex = 4 Me.lblStationID.Text = "Station ID:" ' 'rdoExportData ' Me.rdoExportData.AutoSize = True - Me.rdoExportData.Location = New System.Drawing.Point(22, 421) - Me.rdoExportData.Margin = New System.Windows.Forms.Padding(4) + Me.rdoExportData.Location = New System.Drawing.Point(15, 281) Me.rdoExportData.Name = "rdoExportData" - Me.rdoExportData.Size = New System.Drawing.Size(156, 24) + Me.rdoExportData.Size = New System.Drawing.Size(107, 17) Me.rdoExportData.TabIndex = 94 Me.rdoExportData.TabStop = True Me.rdoExportData.Text = "Export Data (csv)" @@ -270,92 +259,62 @@ Partial Class dlgExportToClimsoft 'rdoNewDataFrame ' Me.rdoNewDataFrame.AutoSize = True - Me.rdoNewDataFrame.Location = New System.Drawing.Point(22, 378) - Me.rdoNewDataFrame.Margin = New System.Windows.Forms.Padding(4) + Me.rdoNewDataFrame.Location = New System.Drawing.Point(15, 252) Me.rdoNewDataFrame.Name = "rdoNewDataFrame" - Me.rdoNewDataFrame.Size = New System.Drawing.Size(154, 24) + Me.rdoNewDataFrame.Size = New System.Drawing.Size(105, 17) Me.rdoNewDataFrame.TabIndex = 93 Me.rdoNewDataFrame.TabStop = True Me.rdoNewDataFrame.Text = "New Data Frame" Me.rdoNewDataFrame.UseVisualStyleBackColor = True ' - 'ucrReceiverComments - ' - Me.ucrReceiverComments.AutoSize = True - Me.ucrReceiverComments.frmParent = Me - Me.ucrReceiverComments.Location = New System.Drawing.Point(427, 557) - Me.ucrReceiverComments.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverComments.Name = "ucrReceiverComments" - Me.ucrReceiverComments.Selector = Nothing - Me.ucrReceiverComments.Size = New System.Drawing.Size(180, 30) - Me.ucrReceiverComments.strNcFilePath = "" - Me.ucrReceiverComments.TabIndex = 92 - Me.ucrReceiverComments.ucrSelector = Nothing - ' 'ucrChkAddReport ' Me.ucrChkAddReport.AutoSize = True Me.ucrChkAddReport.Checked = False - Me.ucrChkAddReport.Location = New System.Drawing.Point(8, 483) - Me.ucrChkAddReport.Margin = New System.Windows.Forms.Padding(9) + Me.ucrChkAddReport.Location = New System.Drawing.Point(5, 322) + Me.ucrChkAddReport.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) Me.ucrChkAddReport.Name = "ucrChkAddReport" - Me.ucrChkAddReport.Size = New System.Drawing.Size(315, 34) + Me.ucrChkAddReport.Size = New System.Drawing.Size(239, 23) Me.ucrChkAddReport.TabIndex = 91 ' - 'lblcomments - ' - Me.lblcomments.AutoSize = True - Me.lblcomments.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblcomments.Location = New System.Drawing.Point(427, 531) - Me.lblcomments.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.lblcomments.Name = "lblcomments" - Me.lblcomments.Size = New System.Drawing.Size(90, 20) - Me.lblcomments.TabIndex = 90 - Me.lblcomments.Tag = "New_Name" - Me.lblcomments.Text = "Comments:" - ' 'ucrDataFrameSheets ' Me.ucrDataFrameSheets.AutoSize = True Me.ucrDataFrameSheets.bDropUnusedFilterLevels = False Me.ucrDataFrameSheets.bUseCurrentFilter = True - Me.ucrDataFrameSheets.Location = New System.Drawing.Point(17, 524) + Me.ucrDataFrameSheets.Location = New System.Drawing.Point(11, 349) Me.ucrDataFrameSheets.Margin = New System.Windows.Forms.Padding(0) Me.ucrDataFrameSheets.Name = "ucrDataFrameSheets" - Me.ucrDataFrameSheets.Size = New System.Drawing.Size(226, 75) + Me.ucrDataFrameSheets.Size = New System.Drawing.Size(151, 50) Me.ucrDataFrameSheets.TabIndex = 89 ' 'ucrPnlOutput ' Me.ucrPnlOutput.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlOutput.Location = New System.Drawing.Point(18, 377) - Me.ucrPnlOutput.Margin = New System.Windows.Forms.Padding(9) + Me.ucrPnlOutput.Location = New System.Drawing.Point(12, 251) + Me.ucrPnlOutput.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) Me.ucrPnlOutput.Name = "ucrPnlOutput" - Me.ucrPnlOutput.Size = New System.Drawing.Size(226, 90) + Me.ucrPnlOutput.Size = New System.Drawing.Size(151, 60) Me.ucrPnlOutput.TabIndex = 95 ' 'grpSave ' - Me.grpSave.Location = New System.Drawing.Point(12, 356) - Me.grpSave.Margin = New System.Windows.Forms.Padding(4) + Me.grpSave.Location = New System.Drawing.Point(8, 237) Me.grpSave.Name = "grpSave" - Me.grpSave.Padding = New System.Windows.Forms.Padding(4) - Me.grpSave.Size = New System.Drawing.Size(248, 110) + Me.grpSave.Size = New System.Drawing.Size(165, 73) Me.grpSave.TabIndex = 96 Me.grpSave.TabStop = False Me.grpSave.Text = "Save" ' 'dlgExportToClimsoft ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(626, 775) + Me.ClientSize = New System.Drawing.Size(417, 467) Me.Controls.Add(Me.rdoExportData) Me.Controls.Add(Me.rdoNewDataFrame) - Me.Controls.Add(Me.ucrReceiverComments) Me.Controls.Add(Me.ucrChkAddReport) - Me.Controls.Add(Me.lblcomments) Me.Controls.Add(Me.ucrDataFrameSheets) Me.Controls.Add(Me.ucrPnlOutput) Me.Controls.Add(Me.grpSave) @@ -377,7 +336,6 @@ Partial Class dlgExportToClimsoft Me.Controls.Add(Me.ucrSelectorImportToClimsoft) Me.Controls.Add(Me.ucrPnlDailyHourly) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog - Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "dlgExportToClimsoft" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Export For Climsoft" @@ -405,9 +363,7 @@ Partial Class dlgExportToClimsoft Friend WithEvents ucrReceiverStationID As ucrReceiverSingle Friend WithEvents rdoExportData As RadioButton Friend WithEvents rdoNewDataFrame As RadioButton - Friend WithEvents ucrReceiverComments As ucrReceiverSingle Friend WithEvents ucrChkAddReport As ucrCheck - Friend WithEvents lblcomments As Label Friend WithEvents ucrDataFrameSheets As ucrDataFrame Friend WithEvents ucrPnlOutput As UcrPanel Friend WithEvents grpSave As GroupBox diff --git a/instat/dlgExportToClimsoft.vb b/instat/dlgExportToClimsoft.vb index 69215091fc..a7bff98136 100644 --- a/instat/dlgExportToClimsoft.vb +++ b/instat/dlgExportToClimsoft.vb @@ -44,14 +44,8 @@ Public Class dlgExportToClimsoft ucrReceiverStationID.SetLinkedDisplayControl(lblStationID) ucrReceiverStationID.Selector = ucrSelectorImportToClimsoft - ucrDataFrameSheets.SetParameter(New RParameter("data_name", 0)) - ucrDataFrameSheets.SetParameterIsString() - - ucrReceiverComments.SetParameter(New RParameter("x", 1)) - ucrReceiverComments.SetParameterIsRFunction() - ucrReceiverComments.SetItemType("dataframe") - - ucrReceiverComments.SetLinkedDisplayControl(lblcomments) + ucrDataFrameSheets.SetParameter(New RParameter("x", 0)) + ucrDataFrameSheets.SetParameterIsRFunction() ucrPnlOutput.AddRadioButton(rdoNewDataFrame) ucrPnlOutput.AddRadioButton(rdoExportData) @@ -59,8 +53,8 @@ Public Class dlgExportToClimsoft ucrPnlOutput.AddParameterValuesCondition(rdoNewDataFrame, "check", "dataframe") ucrPnlOutput.AddParameterValuesCondition(rdoExportData, "check", "export") - ucrChkAddReport.SetText("Add Reports") - ucrChkAddReport.AddToLinkedControls({ucrReceiverComments, ucrDataFrameSheets, ucrInputExportFile}, {True}, bNewLinkedHideIfParameterMissing:=True) + ucrChkAddReport.SetText("Add Report (Comments Sheet)") + ucrChkAddReport.AddToLinkedControls({ucrDataFrameSheets, ucrInputExportFile}, {True}, bNewLinkedHideIfParameterMissing:=True) ucrChkAddReport.AddParameterValuesCondition(True, "comments", "True") ucrChkAddReport.AddParameterValuesCondition(False, "comments", "False") @@ -159,10 +153,10 @@ Public Class dlgExportToClimsoft ucrSaveNewDataFrame.SetRCode(clsPipeOperator, bReset) ucrInputExportFile.SetRCode(clsExportClimsoftFunction, bReset) ucrPnlDailyHourly.SetRCode(clsDummyFunction, bReset) + ucrDataFrameSheets.SetRCode(clsExportCommentsFunction, bReset) If bReset Then ucrPnlOutput.SetRCode(clsDummyFunction, bReset) ucrChkAddReport.SetRCode(clsDummyFunction, bReset) - ucrReceiverComments.SetRCode(clsExportCommentsFunction, bReset) End If End Sub @@ -174,20 +168,24 @@ Public Class dlgExportToClimsoft Else ucrBase.OKEnabled(False) End If - ElseIf rdoExportData.Checked Then - If Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverElements.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If - ElseIf ucrChkAddReport.Checked And rdoExportData.Checked Then - If Not ucrReceiverComments.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then - ucrBase.OKEnabled(True) + Else + + If Not ucrChkAddReport.Checked Then + If Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverElements.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If Else - ucrBase.OKEnabled(False) + If ucrDataFrameSheets.cboAvailableDataFrames.Text <> "" AndAlso Not ucrInputExportFile.IsEmpty Then + ucrBase.OKEnabled(True) + + Else + ucrBase.OKEnabled(False) + + End If End If End If - End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -249,10 +247,12 @@ Public Class dlgExportToClimsoft End Sub Private Sub AddingComments() - If ucrDataFrameSheets.cboAvailableDataFrames.Text = ".comment" Then - ucrReceiverComments.SetText(ucrDataFrameSheets.cboAvailableDataFrames.Text) + ' Check if .comment is in the list and set it as the default selection + If ucrDataFrameSheets.cboAvailableDataFrames.Items.Contains(".comment") Then + ucrDataFrameSheets.cboAvailableDataFrames.Text = ".comment" Else - ucrReceiverComments.SetText("") + ' Optionally, set the first item as the default if .comment is not present + ucrDataFrameSheets.cboAvailableDataFrames.SelectedIndex = 0 End If End Sub @@ -284,8 +284,8 @@ Public Class dlgExportToClimsoft End Sub Private Sub ucrReceiverElements_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElements.ControlContentsChanged, - ucrReceiverDate.ControlContentsChanged, ucrSaveNewDataFrame.ControlContentsChanged, - ucrReceiverStationID.ControlContentsChanged, ucrInputExportFile.ControlContentsChanged + ucrReceiverDate.ControlContentsChanged, ucrSaveNewDataFrame.ControlContentsChanged, ucrChkAddReport.ControlContentsChanged, + ucrReceiverStationID.ControlContentsChanged, ucrInputExportFile.ControlContentsChanged, ucrDataFrameSheets.ControlContentsChanged TestOkEnabled() End Sub @@ -299,13 +299,12 @@ Public Class dlgExportToClimsoft Private Sub ucrDataFrameSheets_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataFrameSheets.ControlValueChanged AddingComments() - End Sub - - Private Sub ucrReceiverComments_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverComments.ControlValueChanged clsExportCommentsFunction.AddParameter("x", clsRFunctionParameter:=ucrDataFrameSheets.clsCurrDataFrame, iPosition:=1) SettingBaseFunction() + End Sub + Private Sub ucrChkAddReport_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddReport.ControlValueChanged AddingComments() If ucrChkAddReport.Checked Then @@ -313,7 +312,7 @@ Public Class dlgExportToClimsoft End If SettingBaseFunction() EnableDisableComments() - + TestOkEnabled() End Sub Private Sub ucrInputHour_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputHour.ControlValueChanged @@ -343,6 +342,7 @@ Public Class dlgExportToClimsoft Private Sub ucrPnlOutput_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOutput.ControlValueChanged EnableDisableComments() SettingBaseFunction() + TestOkEnabled() End Sub End Class \ No newline at end of file From 4380d012db604ea44018ca12ecb3a050e3d33f44 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Mon, 14 Oct 2024 17:43:53 +0300 Subject: [PATCH 3/6] changes --- instat/dlgExportToClimsoft.vb | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/instat/dlgExportToClimsoft.vb b/instat/dlgExportToClimsoft.vb index a7bff98136..5a4aab0769 100644 --- a/instat/dlgExportToClimsoft.vb +++ b/instat/dlgExportToClimsoft.vb @@ -20,7 +20,7 @@ Imports instat.Translations Public Class dlgExportToClimsoft Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsDataFrameFunction, clsCurrentNewColumnFunction, clsDummyFunction, clsMutateFunction, clsExportClimsoftFunction, clsPasteFunction, clsSprintfFunction, clsPosixctFunction, clsExportCommentsFunction As New RFunction + Private clsDataFrameFunction, clsGetDataFrameFunction, clsCurrentNewColumnFunction, clsDummyFunction, clsMutateFunction, clsExportClimsoftFunction, clsPasteFunction, clsSprintfFunction, clsPosixctFunction, clsExportCommentsFunction As New RFunction Private clsPipeOperator As New ROperator Private Sub dlgExportToClimsoft_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -85,7 +85,6 @@ Public Class dlgExportToClimsoft ucrInputExportFile.SetParameter(New RParameter("file", 1)) ucrInputExportFile.IsReadOnly = True ucrInputExportFile.SetLinkedDisplayControl(lblExport) - End Sub Private Sub SetDefaults() @@ -133,8 +132,12 @@ Public Class dlgExportToClimsoft clsSprintfFunction.SetRCommand("sprintf") clsSprintfFunction.AddParameter("hour", 6, iPosition:=1, bIncludeArgumentName:=False) + clsGetDataFrameFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame") + clsGetDataFrameFunction.SetAssignTo(ucrDataFrameSheets.cboAvailableDataFrames.Text) + clsExportCommentsFunction.SetPackageName("rio") clsExportCommentsFunction.SetRCommand("export") + clsExportCommentsFunction.AddParameter("x", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=1) ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) @@ -153,7 +156,6 @@ Public Class dlgExportToClimsoft ucrSaveNewDataFrame.SetRCode(clsPipeOperator, bReset) ucrInputExportFile.SetRCode(clsExportClimsoftFunction, bReset) ucrPnlDailyHourly.SetRCode(clsDummyFunction, bReset) - ucrDataFrameSheets.SetRCode(clsExportCommentsFunction, bReset) If bReset Then ucrPnlOutput.SetRCode(clsDummyFunction, bReset) ucrChkAddReport.SetRCode(clsDummyFunction, bReset) @@ -169,7 +171,6 @@ Public Class dlgExportToClimsoft ucrBase.OKEnabled(False) End If Else - If Not ucrChkAddReport.Checked Then If Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverElements.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then ucrBase.OKEnabled(True) @@ -201,7 +202,6 @@ Public Class dlgExportToClimsoft End If ucrSaveNewDataFrame.SetPrefix(strDataframeName & "__climsoft") - End Sub Private Sub ucrSelectorImportToClimsoft_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorImportToClimsoft.ControlValueChanged @@ -246,17 +246,6 @@ Public Class dlgExportToClimsoft End If End Sub - Private Sub AddingComments() - ' Check if .comment is in the list and set it as the default selection - If ucrDataFrameSheets.cboAvailableDataFrames.Items.Contains(".comment") Then - ucrDataFrameSheets.cboAvailableDataFrames.Text = ".comment" - Else - ' Optionally, set the first item as the default if .comment is not present - ucrDataFrameSheets.cboAvailableDataFrames.SelectedIndex = 0 - End If - - End Sub - Private Sub SelectFileToSave() Using dlgSave As New SaveFileDialog dlgSave.Title = "Save CPT File" @@ -298,15 +287,14 @@ Public Class dlgExportToClimsoft End Sub Private Sub ucrDataFrameSheets_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataFrameSheets.ControlValueChanged - AddingComments() - clsExportCommentsFunction.AddParameter("x", clsRFunctionParameter:=ucrDataFrameSheets.clsCurrDataFrame, iPosition:=1) SettingBaseFunction() - End Sub + clsGetDataFrameFunction.AddParameter("data_name", Chr(34) & ucrDataFrameSheets.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsGetDataFrameFunction.SetAssignTo(ucrDataFrameSheets.cboAvailableDataFrames.Text) + End Sub Private Sub ucrChkAddReport_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddReport.ControlValueChanged - AddingComments() If ucrChkAddReport.Checked Then ucrInputExportFile.SetName("") End If From 18a67d45238a8c9c6f45ca5f182296a272208000 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Tue, 15 Oct 2024 12:21:49 +0300 Subject: [PATCH 4/6] changes --- instat/dlgExportToClimsoft.Designer.vb | 269 +++++++++++++------------ instat/dlgExportToClimsoft.vb | 75 +++---- 2 files changed, 164 insertions(+), 180 deletions(-) diff --git a/instat/dlgExportToClimsoft.Designer.vb b/instat/dlgExportToClimsoft.Designer.vb index 73783bb0ca..04cd11be29 100644 --- a/instat/dlgExportToClimsoft.Designer.vb +++ b/instat/dlgExportToClimsoft.Designer.vb @@ -27,6 +27,16 @@ Partial Class dlgExportToClimsoft Me.lblHour = New System.Windows.Forms.Label() Me.lblExport = New System.Windows.Forms.Label() Me.cmdBrowse = New System.Windows.Forms.Button() + Me.rdoHourly = New System.Windows.Forms.RadioButton() + Me.rdoDaily = New System.Windows.Forms.RadioButton() + Me.lblStationID = New System.Windows.Forms.Label() + Me.rdoExportData = New System.Windows.Forms.RadioButton() + Me.rdoNewDataFrame = New System.Windows.Forms.RadioButton() + Me.grpSave = New System.Windows.Forms.GroupBox() + Me.rdoExportComments = New System.Windows.Forms.RadioButton() + Me.ucrDataFrameSheets = New instat.ucrDataFrame() + Me.ucrPnlOutput = New instat.UcrPanel() + Me.ucrReceiverStationID = New instat.ucrReceiverSingle() Me.ucrInputExportFile = New instat.ucrInputTextBox() Me.ucrSaveNewDataFrame = New instat.ucrSave() Me.ucrInputHour = New instat.ucrInputTextBox() @@ -34,17 +44,7 @@ Partial Class dlgExportToClimsoft Me.ucrReceiverElements = New instat.ucrReceiverMultiple() Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrSelectorImportToClimsoft = New instat.ucrSelectorByDataFrameAddRemove() - Me.rdoHourly = New System.Windows.Forms.RadioButton() - Me.rdoDaily = New System.Windows.Forms.RadioButton() Me.ucrPnlDailyHourly = New instat.UcrPanel() - Me.ucrReceiverStationID = New instat.ucrReceiverSingle() - Me.lblStationID = New System.Windows.Forms.Label() - Me.rdoExportData = New System.Windows.Forms.RadioButton() - Me.rdoNewDataFrame = New System.Windows.Forms.RadioButton() - Me.ucrChkAddReport = New instat.ucrCheck() - Me.ucrDataFrameSheets = New instat.ucrDataFrame() - Me.ucrPnlOutput = New instat.UcrPanel() - Me.grpSave = New System.Windows.Forms.GroupBox() Me.SuspendLayout() ' 'lblElement @@ -78,7 +78,7 @@ Partial Class dlgExportToClimsoft ' Me.lblExport.AutoSize = True Me.lblExport.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblExport.Location = New System.Drawing.Point(9, 436) + Me.lblExport.Location = New System.Drawing.Point(9, 431) Me.lblExport.Name = "lblExport" Me.lblExport.Size = New System.Drawing.Size(59, 13) Me.lblExport.TabIndex = 15 @@ -87,94 +87,13 @@ Partial Class dlgExportToClimsoft 'cmdBrowse ' Me.cmdBrowse.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdBrowse.Location = New System.Drawing.Point(326, 431) + Me.cmdBrowse.Location = New System.Drawing.Point(326, 426) Me.cmdBrowse.Name = "cmdBrowse" Me.cmdBrowse.Size = New System.Drawing.Size(80, 23) Me.cmdBrowse.TabIndex = 17 Me.cmdBrowse.Text = "Browse" Me.cmdBrowse.UseVisualStyleBackColor = True ' - 'ucrInputExportFile - ' - Me.ucrInputExportFile.AddQuotesIfUnrecognised = True - Me.ucrInputExportFile.AutoSize = True - Me.ucrInputExportFile.IsMultiline = False - Me.ucrInputExportFile.IsReadOnly = False - Me.ucrInputExportFile.Location = New System.Drawing.Point(142, 432) - Me.ucrInputExportFile.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) - Me.ucrInputExportFile.Name = "ucrInputExportFile" - Me.ucrInputExportFile.Size = New System.Drawing.Size(182, 21) - Me.ucrInputExportFile.TabIndex = 16 - ' - 'ucrSaveNewDataFrame - ' - Me.ucrSaveNewDataFrame.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(9, 403) - Me.ucrSaveNewDataFrame.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrSaveNewDataFrame.Name = "ucrSaveNewDataFrame" - Me.ucrSaveNewDataFrame.Size = New System.Drawing.Size(348, 24) - Me.ucrSaveNewDataFrame.TabIndex = 14 - ' - 'ucrInputHour - ' - Me.ucrInputHour.AddQuotesIfUnrecognised = True - Me.ucrInputHour.AutoSize = True - Me.ucrInputHour.IsMultiline = False - Me.ucrInputHour.IsReadOnly = False - Me.ucrInputHour.Location = New System.Drawing.Point(278, 153) - Me.ucrInputHour.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) - Me.ucrInputHour.Name = "ucrInputHour" - Me.ucrInputHour.Size = New System.Drawing.Size(119, 21) - Me.ucrInputHour.TabIndex = 9 - ' - 'ucrBase - ' - Me.ucrBase.AutoSize = True - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(7, 459) - Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(408, 52) - Me.ucrBase.TabIndex = 18 - ' - 'ucrReceiverElements - ' - Me.ucrReceiverElements.AutoSize = True - Me.ucrReceiverElements.frmParent = Me - Me.ucrReceiverElements.Location = New System.Drawing.Point(278, 199) - Me.ucrReceiverElements.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverElements.Name = "ucrReceiverElements" - Me.ucrReceiverElements.Selector = Nothing - Me.ucrReceiverElements.Size = New System.Drawing.Size(120, 100) - Me.ucrReceiverElements.strNcFilePath = "" - Me.ucrReceiverElements.TabIndex = 11 - Me.ucrReceiverElements.ucrSelector = Nothing - ' - 'ucrReceiverDate - ' - Me.ucrReceiverDate.AutoSize = True - Me.ucrReceiverDate.frmParent = Me - Me.ucrReceiverDate.Location = New System.Drawing.Point(278, 110) - Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverDate.Name = "ucrReceiverDate" - Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverDate.strNcFilePath = "" - Me.ucrReceiverDate.TabIndex = 7 - Me.ucrReceiverDate.ucrSelector = Nothing - ' - 'ucrSelectorImportToClimsoft - ' - Me.ucrSelectorImportToClimsoft.AutoSize = True - Me.ucrSelectorImportToClimsoft.bDropUnusedFilterLevels = False - Me.ucrSelectorImportToClimsoft.bShowHiddenColumns = False - Me.ucrSelectorImportToClimsoft.bUseCurrentFilter = True - Me.ucrSelectorImportToClimsoft.Location = New System.Drawing.Point(9, 52) - Me.ucrSelectorImportToClimsoft.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSelectorImportToClimsoft.Name = "ucrSelectorImportToClimsoft" - Me.ucrSelectorImportToClimsoft.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorImportToClimsoft.TabIndex = 3 - ' 'rdoHourly ' Me.rdoHourly.Appearance = System.Windows.Forms.Appearance.Button @@ -214,28 +133,6 @@ Partial Class dlgExportToClimsoft Me.rdoDaily.TextAlign = System.Drawing.ContentAlignment.MiddleCenter Me.rdoDaily.UseVisualStyleBackColor = False ' - 'ucrPnlDailyHourly - ' - Me.ucrPnlDailyHourly.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlDailyHourly.Location = New System.Drawing.Point(91, 8) - Me.ucrPnlDailyHourly.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) - Me.ucrPnlDailyHourly.Name = "ucrPnlDailyHourly" - Me.ucrPnlDailyHourly.Size = New System.Drawing.Size(207, 28) - Me.ucrPnlDailyHourly.TabIndex = 0 - ' - 'ucrReceiverStationID - ' - Me.ucrReceiverStationID.AutoSize = True - Me.ucrReceiverStationID.frmParent = Me - Me.ucrReceiverStationID.Location = New System.Drawing.Point(276, 73) - Me.ucrReceiverStationID.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverStationID.Name = "ucrReceiverStationID" - Me.ucrReceiverStationID.Selector = Nothing - Me.ucrReceiverStationID.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverStationID.strNcFilePath = "" - Me.ucrReceiverStationID.TabIndex = 5 - Me.ucrReceiverStationID.ucrSelector = Nothing - ' 'lblStationID ' Me.lblStationID.AutoSize = True @@ -267,15 +164,25 @@ Partial Class dlgExportToClimsoft Me.rdoNewDataFrame.Text = "New Data Frame" Me.rdoNewDataFrame.UseVisualStyleBackColor = True ' - 'ucrChkAddReport + 'grpSave ' - Me.ucrChkAddReport.AutoSize = True - Me.ucrChkAddReport.Checked = False - Me.ucrChkAddReport.Location = New System.Drawing.Point(5, 322) - Me.ucrChkAddReport.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) - Me.ucrChkAddReport.Name = "ucrChkAddReport" - Me.ucrChkAddReport.Size = New System.Drawing.Size(239, 23) - Me.ucrChkAddReport.TabIndex = 91 + Me.grpSave.Location = New System.Drawing.Point(8, 237) + Me.grpSave.Name = "grpSave" + Me.grpSave.Size = New System.Drawing.Size(165, 109) + Me.grpSave.TabIndex = 96 + Me.grpSave.TabStop = False + Me.grpSave.Text = "Save" + ' + 'rdoExportComments + ' + Me.rdoExportComments.AutoSize = True + Me.rdoExportComments.Location = New System.Drawing.Point(15, 306) + Me.rdoExportComments.Name = "rdoExportComments" + Me.rdoExportComments.Size = New System.Drawing.Size(107, 17) + Me.rdoExportComments.TabIndex = 97 + Me.rdoExportComments.TabStop = True + Me.rdoExportComments.Text = "Export Comments" + Me.rdoExportComments.UseVisualStyleBackColor = True ' 'ucrDataFrameSheets ' @@ -292,19 +199,113 @@ Partial Class dlgExportToClimsoft ' Me.ucrPnlOutput.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrPnlOutput.Location = New System.Drawing.Point(12, 251) - Me.ucrPnlOutput.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) + Me.ucrPnlOutput.Margin = New System.Windows.Forms.Padding(6) Me.ucrPnlOutput.Name = "ucrPnlOutput" - Me.ucrPnlOutput.Size = New System.Drawing.Size(151, 60) + Me.ucrPnlOutput.Size = New System.Drawing.Size(151, 86) Me.ucrPnlOutput.TabIndex = 95 ' - 'grpSave + 'ucrReceiverStationID ' - Me.grpSave.Location = New System.Drawing.Point(8, 237) - Me.grpSave.Name = "grpSave" - Me.grpSave.Size = New System.Drawing.Size(165, 73) - Me.grpSave.TabIndex = 96 - Me.grpSave.TabStop = False - Me.grpSave.Text = "Save" + Me.ucrReceiverStationID.AutoSize = True + Me.ucrReceiverStationID.frmParent = Me + Me.ucrReceiverStationID.Location = New System.Drawing.Point(276, 73) + Me.ucrReceiverStationID.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverStationID.Name = "ucrReceiverStationID" + Me.ucrReceiverStationID.Selector = Nothing + Me.ucrReceiverStationID.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverStationID.strNcFilePath = "" + Me.ucrReceiverStationID.TabIndex = 5 + Me.ucrReceiverStationID.ucrSelector = Nothing + ' + 'ucrInputExportFile + ' + Me.ucrInputExportFile.AddQuotesIfUnrecognised = True + Me.ucrInputExportFile.AutoSize = True + Me.ucrInputExportFile.IsMultiline = False + Me.ucrInputExportFile.IsReadOnly = False + Me.ucrInputExportFile.Location = New System.Drawing.Point(142, 427) + Me.ucrInputExportFile.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) + Me.ucrInputExportFile.Name = "ucrInputExportFile" + Me.ucrInputExportFile.Size = New System.Drawing.Size(182, 21) + Me.ucrInputExportFile.TabIndex = 16 + ' + 'ucrSaveNewDataFrame + ' + Me.ucrSaveNewDataFrame.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(9, 399) + Me.ucrSaveNewDataFrame.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveNewDataFrame.Name = "ucrSaveNewDataFrame" + Me.ucrSaveNewDataFrame.Size = New System.Drawing.Size(348, 24) + Me.ucrSaveNewDataFrame.TabIndex = 14 + ' + 'ucrInputHour + ' + Me.ucrInputHour.AddQuotesIfUnrecognised = True + Me.ucrInputHour.AutoSize = True + Me.ucrInputHour.IsMultiline = False + Me.ucrInputHour.IsReadOnly = False + Me.ucrInputHour.Location = New System.Drawing.Point(278, 153) + Me.ucrInputHour.Margin = New System.Windows.Forms.Padding(9) + Me.ucrInputHour.Name = "ucrInputHour" + Me.ucrInputHour.Size = New System.Drawing.Size(119, 21) + Me.ucrInputHour.TabIndex = 9 + ' + 'ucrBase + ' + Me.ucrBase.AutoSize = True + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(7, 459) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(408, 52) + Me.ucrBase.TabIndex = 18 + ' + 'ucrReceiverElements + ' + Me.ucrReceiverElements.AutoSize = True + Me.ucrReceiverElements.frmParent = Me + Me.ucrReceiverElements.Location = New System.Drawing.Point(278, 199) + Me.ucrReceiverElements.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverElements.Name = "ucrReceiverElements" + Me.ucrReceiverElements.Selector = Nothing + Me.ucrReceiverElements.Size = New System.Drawing.Size(120, 100) + Me.ucrReceiverElements.strNcFilePath = "" + Me.ucrReceiverElements.TabIndex = 11 + Me.ucrReceiverElements.ucrSelector = Nothing + ' + 'ucrReceiverDate + ' + Me.ucrReceiverDate.AutoSize = True + Me.ucrReceiverDate.frmParent = Me + Me.ucrReceiverDate.Location = New System.Drawing.Point(278, 110) + Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverDate.strNcFilePath = "" + Me.ucrReceiverDate.TabIndex = 7 + Me.ucrReceiverDate.ucrSelector = Nothing + ' + 'ucrSelectorImportToClimsoft + ' + Me.ucrSelectorImportToClimsoft.AutoSize = True + Me.ucrSelectorImportToClimsoft.bDropUnusedFilterLevels = False + Me.ucrSelectorImportToClimsoft.bShowHiddenColumns = False + Me.ucrSelectorImportToClimsoft.bUseCurrentFilter = True + Me.ucrSelectorImportToClimsoft.Location = New System.Drawing.Point(9, 52) + Me.ucrSelectorImportToClimsoft.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorImportToClimsoft.Name = "ucrSelectorImportToClimsoft" + Me.ucrSelectorImportToClimsoft.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorImportToClimsoft.TabIndex = 3 + ' + 'ucrPnlDailyHourly + ' + Me.ucrPnlDailyHourly.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlDailyHourly.Location = New System.Drawing.Point(91, 8) + Me.ucrPnlDailyHourly.Margin = New System.Windows.Forms.Padding(4) + Me.ucrPnlDailyHourly.Name = "ucrPnlDailyHourly" + Me.ucrPnlDailyHourly.Size = New System.Drawing.Size(207, 28) + Me.ucrPnlDailyHourly.TabIndex = 0 ' 'dlgExportToClimsoft ' @@ -312,9 +313,9 @@ Partial Class dlgExportToClimsoft Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(417, 467) + Me.Controls.Add(Me.rdoExportComments) Me.Controls.Add(Me.rdoExportData) Me.Controls.Add(Me.rdoNewDataFrame) - Me.Controls.Add(Me.ucrChkAddReport) Me.Controls.Add(Me.ucrDataFrameSheets) Me.Controls.Add(Me.ucrPnlOutput) Me.Controls.Add(Me.grpSave) @@ -363,8 +364,8 @@ Partial Class dlgExportToClimsoft Friend WithEvents ucrReceiverStationID As ucrReceiverSingle Friend WithEvents rdoExportData As RadioButton Friend WithEvents rdoNewDataFrame As RadioButton - Friend WithEvents ucrChkAddReport As ucrCheck Friend WithEvents ucrDataFrameSheets As ucrDataFrame Friend WithEvents ucrPnlOutput As UcrPanel Friend WithEvents grpSave As GroupBox + Friend WithEvents rdoExportComments As RadioButton End Class diff --git a/instat/dlgExportToClimsoft.vb b/instat/dlgExportToClimsoft.vb index 5a4aab0769..6f6a5e2f88 100644 --- a/instat/dlgExportToClimsoft.vb +++ b/instat/dlgExportToClimsoft.vb @@ -49,14 +49,14 @@ Public Class dlgExportToClimsoft ucrPnlOutput.AddRadioButton(rdoNewDataFrame) ucrPnlOutput.AddRadioButton(rdoExportData) + ucrPnlOutput.AddRadioButton(rdoExportComments) + ucrPnlOutput.AddParameterValuesCondition(rdoNewDataFrame, "check", "dataframe") ucrPnlOutput.AddParameterValuesCondition(rdoExportData, "check", "export") + ucrPnlOutput.AddParameterValuesCondition(rdoExportComments, "check", "comments") - ucrChkAddReport.SetText("Add Report (Comments Sheet)") - ucrChkAddReport.AddToLinkedControls({ucrDataFrameSheets, ucrInputExportFile}, {True}, bNewLinkedHideIfParameterMissing:=True) - ucrChkAddReport.AddParameterValuesCondition(True, "comments", "True") - ucrChkAddReport.AddParameterValuesCondition(False, "comments", "False") + ucrPnlOutput.AddToLinkedControls({ucrDataFrameSheets, ucrInputExportFile}, {rdoExportComments}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) ucrReceiverDate.SetParameter(New RParameter("date", 2)) ucrReceiverDate.SetParameterIsRFunction() @@ -158,7 +158,6 @@ Public Class dlgExportToClimsoft ucrPnlDailyHourly.SetRCode(clsDummyFunction, bReset) If bReset Then ucrPnlOutput.SetRCode(clsDummyFunction, bReset) - ucrChkAddReport.SetRCode(clsDummyFunction, bReset) End If End Sub @@ -170,21 +169,20 @@ Public Class dlgExportToClimsoft Else ucrBase.OKEnabled(False) End If - Else - If Not ucrChkAddReport.Checked Then - If Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverElements.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If + ElseIf rdoExportData.Checked Then + If Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverElements.IsEmpty AndAlso Not ucrInputExportFile.IsEmpty Then + ucrBase.OKEnabled(True) Else - If ucrDataFrameSheets.cboAvailableDataFrames.Text <> "" AndAlso Not ucrInputExportFile.IsEmpty Then - ucrBase.OKEnabled(True) + ucrBase.OKEnabled(False) + End If - Else - ucrBase.OKEnabled(False) + Else + If ucrDataFrameSheets.cboAvailableDataFrames.Text <> "" AndAlso Not ucrInputExportFile.IsEmpty Then + ucrBase.OKEnabled(True) + + Else + ucrBase.OKEnabled(False) - End If End If End If End Sub @@ -216,6 +214,10 @@ Public Class dlgExportToClimsoft SettingBaseFunction() End Sub + Private Sub ucrInputExportFile_ControlValueChanged(ucrChangedControl As ucrCore) + + End Sub + Private Sub cmdBrowse_Click(sender As Object, e As EventArgs) Handles cmdBrowse.Click SelectFileToSave() End Sub @@ -228,22 +230,24 @@ Public Class dlgExportToClimsoft ucrBase.clsRsyntax.GetAfterCodes().Clear() cmdBrowse.Visible = False ucrInputExportFile.Visible = False + ucrSaveNewDataFrame.Visible = True - Else + ElseIf rdoExportData.Checked Then ucrBase.clsRsyntax.GetAfterCodes().Clear() ucrBase.clsRsyntax.AddToBeforeCodes(clsCurrentNewColumnFunction) ucrBase.clsRsyntax.SetBaseRFunction(clsExportClimsoftFunction) ucrBase.clsRsyntax.GetAfterCodes().Clear() cmdBrowse.Visible = True ucrInputExportFile.Visible = True - End If - - If ucrChkAddReport.Checked AndAlso rdoExportData.Checked Then + ucrSaveNewDataFrame.Visible = False + Else ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetBaseRFunction(clsExportCommentsFunction) cmdBrowse.Visible = True ucrInputExportFile.Visible = True + ucrSaveNewDataFrame.Visible = False End If + End Sub Private Sub SelectFileToSave() @@ -262,18 +266,8 @@ Public Class dlgExportToClimsoft End Using End Sub - Private Sub EnableDisableComments() - If rdoExportData.Checked Then - ucrChkAddReport.Enabled = True - Else - ucrChkAddReport.Enabled = False - ucrChkAddReport.Checked = False - End If - - End Sub - Private Sub ucrReceiverElements_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElements.ControlContentsChanged, - ucrReceiverDate.ControlContentsChanged, ucrSaveNewDataFrame.ControlContentsChanged, ucrChkAddReport.ControlContentsChanged, + ucrReceiverDate.ControlContentsChanged, ucrSaveNewDataFrame.ControlContentsChanged, ucrReceiverStationID.ControlContentsChanged, ucrInputExportFile.ControlContentsChanged, ucrDataFrameSheets.ControlContentsChanged TestOkEnabled() End Sub @@ -283,7 +277,6 @@ Public Class dlgExportToClimsoft SelectFileToSave() End If SettingBaseFunction() - EnableDisableComments() End Sub Private Sub ucrDataFrameSheets_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataFrameSheets.ControlValueChanged @@ -294,15 +287,6 @@ Public Class dlgExportToClimsoft End Sub - Private Sub ucrChkAddReport_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddReport.ControlValueChanged - If ucrChkAddReport.Checked Then - ucrInputExportFile.SetName("") - End If - SettingBaseFunction() - EnableDisableComments() - TestOkEnabled() - End Sub - Private Sub ucrInputHour_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputHour.ControlValueChanged If Not ucrInputHour.IsEmpty Then clsSprintfFunction.AddParameter("fmt", Chr(34) & "%02d:00:00" & Chr(34), iPosition:=0) @@ -323,12 +307,11 @@ Public Class dlgExportToClimsoft End If End Sub - Private Sub ucrInputExportFile_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputExportFile.ControlValueChanged - EnableDisableComments() - End Sub + 'Private Sub ucrInputExportFile_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputExportFile.ControlValueChanged + ' EnableDisableComments() + 'End Sub Private Sub ucrPnlOutput_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOutput.ControlValueChanged - EnableDisableComments() SettingBaseFunction() TestOkEnabled() End Sub From d0c13b3dbd51c634cbc6936b92c0d76e4fe0fc3c Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Tue, 15 Oct 2024 15:20:38 +0300 Subject: [PATCH 5/6] changes --- instat/dlgExportToClimsoft.vb | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/instat/dlgExportToClimsoft.vb b/instat/dlgExportToClimsoft.vb index 6f6a5e2f88..44f49a451e 100644 --- a/instat/dlgExportToClimsoft.vb +++ b/instat/dlgExportToClimsoft.vb @@ -214,8 +214,22 @@ Public Class dlgExportToClimsoft SettingBaseFunction() End Sub - Private Sub ucrInputExportFile_ControlValueChanged(ucrChangedControl As ucrCore) - + Private Sub ucrDataFrameSheets_Load(sender As Object, e As EventArgs) Handles ucrDataFrameSheets.Load + If ucrDataFrameSheets.cboAvailableDataFrames.Items.Count > 0 Then + ' Check if the .comment dataframe exists + Dim commentExists As Boolean = False + For Each dataframe As String In ucrDataFrameSheets.cboAvailableDataFrames.Items + If dataframe = ".comment" Then + commentExists = True + Exit For + End If + Next + + ' Set .comment as the default selection if it exists + If commentExists Then + ucrDataFrameSheets.cboAvailableDataFrames.SelectedItem = ".comment" + End If + End If End Sub Private Sub cmdBrowse_Click(sender As Object, e As EventArgs) Handles cmdBrowse.Click @@ -307,10 +321,6 @@ Public Class dlgExportToClimsoft End If End Sub - 'Private Sub ucrInputExportFile_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputExportFile.ControlValueChanged - ' EnableDisableComments() - 'End Sub - Private Sub ucrPnlOutput_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOutput.ControlValueChanged SettingBaseFunction() TestOkEnabled() From 9e5bdfcd406501f4bd84328e8a99bc231213b488 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Thu, 17 Oct 2024 12:53:56 +0300 Subject: [PATCH 6/6] changes --- instat/dlgExportToClimsoft.vb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/instat/dlgExportToClimsoft.vb b/instat/dlgExportToClimsoft.vb index 44f49a451e..5db37c474e 100644 --- a/instat/dlgExportToClimsoft.vb +++ b/instat/dlgExportToClimsoft.vb @@ -50,8 +50,6 @@ Public Class dlgExportToClimsoft ucrPnlOutput.AddRadioButton(rdoNewDataFrame) ucrPnlOutput.AddRadioButton(rdoExportData) ucrPnlOutput.AddRadioButton(rdoExportComments) - - ucrPnlOutput.AddParameterValuesCondition(rdoNewDataFrame, "check", "dataframe") ucrPnlOutput.AddParameterValuesCondition(rdoExportData, "check", "export") ucrPnlOutput.AddParameterValuesCondition(rdoExportComments, "check", "comments") @@ -217,16 +215,16 @@ Public Class dlgExportToClimsoft Private Sub ucrDataFrameSheets_Load(sender As Object, e As EventArgs) Handles ucrDataFrameSheets.Load If ucrDataFrameSheets.cboAvailableDataFrames.Items.Count > 0 Then ' Check if the .comment dataframe exists - Dim commentExists As Boolean = False + Dim bcommentExists As Boolean = False For Each dataframe As String In ucrDataFrameSheets.cboAvailableDataFrames.Items If dataframe = ".comment" Then - commentExists = True + bcommentExists = True Exit For End If Next ' Set .comment as the default selection if it exists - If commentExists Then + If bcommentExists Then ucrDataFrameSheets.cboAvailableDataFrames.SelectedItem = ".comment" End If End If