Skip to content

Commit f790e8d

Browse files
committed
bug fixed when databoo closed
1 parent 3064d3c commit f790e8d

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed

instat/DlgDefineClimaticData.vb

+31-35
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ Public Class DlgDefineClimaticData
3232
Private bIsUnique As Boolean = True
3333

3434
Private Sub DlgDefineClimaticData_Load(sender As Object, e As EventArgs) Handles MyBase.Load
35-
Dim stopwatch As New Stopwatch()
36-
stopwatch.Start()
3735
autoTranslate(Me)
3836
If bFirstLoad Then
3937
InitialiseDialog()
@@ -45,9 +43,6 @@ Public Class DlgDefineClimaticData
4543
SetRCodeForControls(bReset)
4644
bReset = False
4745
TestOKEnabled()
48-
stopwatch.Stop()
49-
Dim Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger()
50-
Logger.Info("DlgDefineClimaticData " & stopwatch.Elapsed.TotalSeconds & " seconds")
5146
End Sub
5247

5348
Private Sub InitialiseDialog()
@@ -132,8 +127,6 @@ Public Class DlgDefineClimaticData
132127
clsDummyFunction = New RFunction
133128
clsNewDefautFunction = New RFunction
134129

135-
'ucrSelectorDefineClimaticData.Reset()
136-
'ucrSelectorLinkedDataFrame.Reset()
137130
ucrInputCheckInput.Reset()
138131
ucrReceiverDate.SetMeAsReceiver()
139132

@@ -235,17 +228,17 @@ Public Class DlgDefineClimaticData
235228
Dim bFound As Boolean = False
236229

237230
ucrCurrentReceiver = ucrSelectorDefineClimaticData.CurrentReceiver
238-
231+
Dim strData As String = ucrSelectorDefineClimaticData.ucrAvailableDataFrames.cboAvailableDataFrames.Text
239232
For Each ucrTempReceiver As ucrReceiver In lstReceivers
240233
ucrTempReceiver.SetMeAsReceiver()
241234
lstRecognisedValues = GetRecognisedValues(ucrTempReceiver.Tag)
242235

243236
If lstRecognisedValues.Count > 0 Then
244237
For Each lviTempVariable As ListViewItem In ucrSelectorDefineClimaticData.lstAvailableVariable.Items
245-
Dim strClimaticType As String = GetClimaticTypeFromRCommand(lviTempVariable.Text)
238+
Dim strClimaticType As String = GetClimaticTypeFromRCommand(lviTempVariable.Text, strData)
246239
For Each strValue As String In lstRecognisedValues
247240
If Regex.Replace(lviTempVariable.Text.ToLower(), "[^\w]|_", String.Empty).Contains(strValue) OrElse (strClimaticType IsNot Nothing AndAlso strClimaticType.Contains(strValue)) Then
248-
ucrTempReceiver.Add(lviTempVariable.Text, ucrSelectorDefineClimaticData.ucrAvailableDataFrames.cboAvailableDataFrames.Text)
241+
ucrTempReceiver.Add(lviTempVariable.Text, strData)
249242
bFound = True
250243
Exit For
251244
End If
@@ -268,43 +261,46 @@ Public Class DlgDefineClimaticData
268261
Dim ucrCurrentReceiver As ucrReceiver
269262
Dim bFound As Boolean = False
270263

271-
ucrCurrentReceiver = ucrSelectorLinkedDataFrame.CurrentReceiver
272-
273-
For Each ucrTempReceiver As ucrReceiver In lstNewReceivers
274-
ucrTempReceiver.SetMeAsReceiver()
275-
lstRecognisedValues = GetNewRecognisedValues(ucrTempReceiver.Tag)
276-
277-
If lstRecognisedValues.Count > 0 Then
278-
For Each lviTempVariable As ListViewItem In ucrSelectorLinkedDataFrame.lstAvailableVariable.Items
279-
Dim strClimaticType As String = GetClimaticTypeFromRCommand(lviTempVariable.Text)
280-
For Each strValue As String In lstRecognisedValues
281-
If Regex.Replace(lviTempVariable.Text.ToLower(), "[^\w]|_", String.Empty).Contains(strValue) OrElse (strClimaticType IsNot Nothing AndAlso strClimaticType.Contains(strValue)) Then
282-
ucrTempReceiver.Add(lviTempVariable.Text, ucrSelectorLinkedDataFrame.ucrAvailableDataFrames.cboAvailableDataFrames.Text)
283-
bFound = True
264+
If ucrChkLinkedMetaData.Checked Then
265+
ucrCurrentReceiver = ucrSelectorLinkedDataFrame.CurrentReceiver
266+
Dim strData As String = ucrSelectorLinkedDataFrame.ucrAvailableDataFrames.cboAvailableDataFrames.Text
267+
268+
For Each ucrTempReceiver As ucrReceiver In lstNewReceivers
269+
ucrTempReceiver.SetMeAsReceiver()
270+
lstRecognisedValues = GetNewRecognisedValues(ucrTempReceiver.Tag)
271+
272+
If lstRecognisedValues.Count > 0 Then
273+
For Each lviTempVariable As ListViewItem In ucrSelectorLinkedDataFrame.lstAvailableVariable.Items
274+
Dim strClimaticType As String = GetClimaticTypeFromRCommand(lviTempVariable.Text, strData)
275+
For Each strValue As String In lstRecognisedValues
276+
If Regex.Replace(lviTempVariable.Text.ToLower(), "[^\w]|_", String.Empty).Contains(strValue) OrElse (strClimaticType IsNot Nothing AndAlso strClimaticType.Contains(strValue)) Then
277+
ucrTempReceiver.Add(lviTempVariable.Text, strData)
278+
bFound = True
279+
Exit For
280+
End If
281+
Next
282+
If bFound Then
283+
bFound = False
284284
Exit For
285285
End If
286286
Next
287-
If bFound Then
288-
bFound = False
289-
Exit For
290-
End If
291-
Next
292-
End If
293-
Next
287+
End If
288+
Next
294289

295-
If ucrCurrentReceiver IsNot Nothing Then
296-
ucrCurrentReceiver.SetMeAsReceiver()
290+
If ucrCurrentReceiver IsNot Nothing Then
291+
ucrCurrentReceiver.SetMeAsReceiver()
292+
End If
297293
End If
298294
End Sub
299295

300-
Private Function GetClimaticTypeFromRCommand(strName As String) As String
296+
Private Function GetClimaticTypeFromRCommand(strName As String, strDataName As String) As String
301297
Try
302298
Dim clsGetClimaticTypeFunction As New RFunction
303299

304300
clsGetClimaticTypeFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_climatic_type")
305301
clsGetClimaticTypeFunction.AddParameter("attr_name", Chr(34) & "Climatic_Type" & Chr(34))
306302
clsGetClimaticTypeFunction.AddParameter("col_name", Chr(34) & strName & Chr(34))
307-
clsGetClimaticTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorLinkedDataFrame.strCurrentDataFrame & Chr(34))
303+
clsGetClimaticTypeFunction.AddParameter("data_name", Chr(34) & strDataName & Chr(34))
308304

309305
Dim result As SymbolicExpression
310306
result = frmMain.clsRLink.RunInternalScriptGetValue(clsGetClimaticTypeFunction.ToScript())
@@ -409,7 +405,7 @@ Public Class DlgDefineClimaticData
409405
AutoFillReceivers()
410406
End Sub
411407

412-
Private Sub ucrSelectorLinkedDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorLinkedDataFrame.ControlValueChanged
408+
Private Sub ucrSelectorLinkedDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorLinkedDataFrame.ControlValueChanged, ucrChkLinkedMetaData.ControlValueChanged
413409
clsGetColFunction.AddParameter("data_name", Chr(34) & ucrSelectorLinkedDataFrame.strCurrentDataFrame & Chr(34), iPosition:=1)
414410
NewAutoFillReceivers()
415411
End Sub

0 commit comments

Comments
 (0)