Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalis95 committed Mar 6, 2024
1 parent 8ea2d05 commit 104b796
Showing 1 changed file with 44 additions and 28 deletions.
72 changes: 44 additions & 28 deletions instat/dlgScript.vb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ Public Class dlgScript
ucrChkDisplayGraph.Checked = True
ucrChkOpenRFile.Checked = False
ucrChkInto.Checked = False
'ucrChkDispla.Checked = False
ucrChkWindow.Checked = True
ucrDataFrameSaveOutputSelect.Reset()

Expand All @@ -198,6 +197,7 @@ Public Class dlgScript
ucrCboGetOutputObjectType.GetSetSelectedIndex = 0
ucrDataFrameGetDF.Reset()
rdoGetDataFrame.Checked = True
rdoDataFrame.Checked = True


'activate the selected tab to library tab
Expand All @@ -211,30 +211,36 @@ Public Class dlgScript
ucrCboSaveOutputObjectType.SetVisible(False)
ucrCboSaveOutputObjectFormat.SetVisible(False)
ucrSaveObject.SetVisible(False)
'ucrInputSaveDataFrame.SetVisible(False)
ucrChkDisplayGraph.Visible = False
ucrPnlSaveDataFrame.SetVisible(False)
' ucrChkSaveDataFrameSingle.SetVisible(False)
If rdoSaveDataFrame.Checked Then
'ucrInputSaveDataFrame.SetVisible(True)
' ucrChkSaveDataFrameSingle.SetVisible(True)
ucrPnlSaveDataFrame.SetVisible(True)

VisiilityOfControls()
ucrChkDisplayGraph.Visible = False
ucrInputSaveDataFrame.SetName("")
ElseIf rdoSaveColumn.Checked Then
ucrSaveObject.Location = New Point(ucrSaveObject.Location.X, ucrCboSaveOutputObjectType.Location.Y)
ucrSaveObject.SetVisible(True)
ucrDataFrameSaveOutputSelect.SetVisible(True)
ucrChkDisplayGraph.Visible = False
ucrInputSaveRFile.SetVisible(False)
ucrInputSaveDataFrame.SetVisible(False)
ucrChkSaveDataFrameSingle.SetVisible(False)
ucrPnlSaveDataFrame.SetVisible(False)
SetupSaveDataControl("Column", RObjectTypeLabel.Column, "")
ElseIf rdoSaveOutputObject.Checked Then
ucrSaveObject.Location = New Point(ucrSaveObject.Location.X, ucrCboSaveOutputObjectFormat.Location.Y + 33)
ucrSaveObject.SetVisible(True)
ucrDataFrameSaveOutputSelect.SetVisible(True)
ucrChkDisplayGraph.Visible = True
ucrCboSaveOutputObjectType.SetVisible(True)
ucrInputSaveRFile.SetVisible(False)
ucrInputSaveDataFrame.SetVisible(False)
ucrCboSaveOutputObjectFormat.SetVisible(True)
ucrChkSaveDataFrameSingle.SetVisible(False)
ucrPnlSaveDataFrame.SetVisible(False)
SetupSaveDataControl(ucrCboSaveOutputObjectType.GetText(), dctOutputObjectTypes.Item(ucrCboSaveOutputObjectType.GetText()), dctOutputObjectFormats.Item(ucrCboSaveOutputObjectFormat.GetText()))
End If
End Sub
Expand All @@ -251,40 +257,46 @@ Public Class dlgScript
ucrSaveObject.SetName("")
End Sub

Private Sub ucrSaveDataFrameControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputSaveDataFrame.ControlContentsChanged, ucrChkSaveDataFrameSingle.ControlContentsChanged
Private Sub ucrSaveDataFrameControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputSaveDataFrame.ControlContentsChanged, ucrChkSaveDataFrameSingle.ControlContentsChanged,
ucrInputSaveRFile.ControlContentsChanged

Dim strScript As String = ""

If Not ucrInputSaveDataFrame.IsEmpty() Then
Dim strDataFrameName As String = ucrInputSaveDataFrame.GetText()
Dim clsImportRFunction As New RFunction
If rdoDataFrame.Checked Then
If Not ucrInputSaveDataFrame.IsEmpty() Then
Dim clsImportRFunction As New RFunction
Dim strDataFrameName As String = ucrInputSaveDataFrame.GetText()

clsImportRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$import_data")
clsImportRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$import_data")

If ucrChkSaveDataFrameSingle.Checked Then
' If it's a single data frame then wrap it into a list
Dim clsDataListRFunction As New RFunction
clsDataListRFunction.SetRCommand("list")
clsDataListRFunction.AddParameter(strParameterName:=strDataFrameName, strParameterValue:=strDataFrameName)
clsImportRFunction.AddParameter(strParameterName:="data_tables", clsRFunctionParameter:=clsDataListRFunction)
Else
' If it's already a list of data frames, then add the name directly
clsImportRFunction.AddParameter(strParameterName:="data_tables", strParameterValue:=strDataFrameName)
End If
If ucrChkSaveDataFrameSingle.Checked Then
' If it's a single data frame then wrap it into a list
Dim clsDataListRFunction As New RFunction
clsDataListRFunction.SetRCommand("list")
clsDataListRFunction.AddParameter(strParameterName:=strDataFrameName, strParameterValue:=strDataFrameName)
clsImportRFunction.AddParameter(strParameterName:="data_tables", clsRFunctionParameter:=clsDataListRFunction)
Else
' If it's already a list of data frames, then add the name directly
clsImportRFunction.AddParameter(strParameterName:="data_tables", strParameterValue:=strDataFrameName)
End If

strScript = "# Save data frame(s) """ & strDataFrameName & """" & Environment.NewLine & clsImportRFunction.ToScript()

strScript = "# Save data frame(s) """ & strDataFrameName & """" & Environment.NewLine & clsImportRFunction.ToScript()
If ucrInputSaveRFile.IsEmpty Then
ucrChkSaveDataFrameSingle.Enabled = False
End If
Else
If Not ucrInputSaveRFile.IsEmpty Then
Dim clsImportRDSFunction As New RFunction
Dim strRFileName As String = ucrInputSaveRFile.GetText()

clsImportRDSFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$import_RDS")
clsImportRDSFunction.AddParameter(strParameterName:="data_RDS", strParameterValue:=strDataFrameName)
clsImportRDSFunction.AddParameter(strParameterName:="data_RDS", strParameterValue:=strRFileName)

strScript = "# Save RDS File(s) """ & strDataFrameName & """" & Environment.NewLine & clsImportRDSFunction.ToScript()
Else
ucrChkSaveDataFrameSingle.Enabled = True
strScript = "# Save RDS File(s) """ & strRFileName & """" & Environment.NewLine & clsImportRDSFunction.ToScript()

End If
End If


PreviewScript(strScript)
End Sub

Expand Down Expand Up @@ -749,11 +761,13 @@ Public Class dlgScript
End Sub

Private Sub ucrPnlSaveDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSaveDataFrame.ControlValueChanged

VisiilityOfControls()
End Sub
Private Sub VisiilityOfControls()
ucrInputSaveRFile.SetVisible(False)
ucrInputSaveDataFrame.SetVisible(False)
ucrChkSaveDataFrameSingle.SetVisible(False)
If rdoSaveDataFrame.Checked Then
If rdoDataFrame.Checked Then
ucrInputSaveDataFrame.SetVisible(True)
ucrChkSaveDataFrameSingle.SetVisible(True)
ucrInputSaveDataFrame.OnControlValueChanged()
Expand All @@ -763,4 +777,6 @@ Public Class dlgScript
ucrInputSaveRFile.OnControlValueChanged()
End If
End Sub


End Class

0 comments on commit 104b796

Please sign in to comment.