@@ -143,9 +143,25 @@ public void ClearMatches()
143
143
{
144
144
//ClearTenativeMatches();
145
145
if ( matches . Tables [ "MATCHEDNUCLIDES" ] != null && matches . Tables [ "MATCHEDNUCLIDES" ] . Rows . Count > 0 )
146
+ {
147
+ string sort = matches . Tables [ "MATCHEDNUCLIDES" ] . DefaultView . Sort ;
146
148
matches . Tables [ "MATCHEDNUCLIDES" ] . Clear ( ) ;
149
+ matches . Tables [ "MATCHEDNUCLIDES" ] . DefaultView . Sort = sort ;
150
+ }
151
+
152
+ ClearLines ( ) ;
153
+ }
154
+ /// <summary>
155
+ /// Clear the Lines
156
+ /// </summary>
157
+ public void ClearLines ( )
158
+ {
147
159
if ( matches . Tables [ "MATCHEDLINES" ] != null && matches . Tables [ "MATCHEDLINES" ] . Rows . Count > 0 )
160
+ {
161
+ string sort = matches . Tables [ "MATCHEDLINES" ] . DefaultView . Sort ;
148
162
matches . Tables [ "MATCHEDLINES" ] . Clear ( ) ;
163
+ matches . Tables [ "MATCHEDLINES" ] . DefaultView . Sort = sort ;
164
+ }
149
165
}
150
166
/// <summary>
151
167
/// Clear the lines a nuclide with the given name
@@ -191,7 +207,14 @@ public void ClearMatches(string name)
191
207
public void Clear ( )
192
208
{
193
209
ClearTenativeMatches ( ) ;
194
- matches . Clear ( ) ;
210
+ ClearMatches ( ) ;
211
+ //matches.Clear();
212
+ if ( matches . Tables [ "PEAKS" ] != null && matches . Tables [ "PEAKS" ] . Rows . Count > 0 )
213
+ {
214
+ string sort = matches . Tables [ "PEAKS" ] . DefaultView . Sort ;
215
+ matches . Tables [ "PEAKS" ] . Clear ( ) ;
216
+ matches . Tables [ "PEAKS" ] . DefaultView . Sort = sort ;
217
+ }
195
218
matches . Tables [ "PEAKS" ] . Columns [ "ID" ] . AutoIncrementSeed = - 1 ;
196
219
matches . Tables [ "PEAKS" ] . Columns [ "ID" ] . AutoIncrementStep = - 1 ;
197
220
@@ -395,7 +418,8 @@ public void SetLines(DataRow nuc, DataRow peak)
395
418
double area = double . TryParse ( peak [ "AREA" ] . ToString ( ) , out area ) ? area : 0.0 ;
396
419
double mda = double . TryParse ( peak [ "CRITLEVEL" ] . ToString ( ) , out mda ) ? 2.71 + 2 * mda : 0.0 ;
397
420
398
- matches . Tables [ "MATCHEDLINES" ] . Clear ( ) ;
421
+ //matches.Tables["MATCHEDLINES"].Clear();
422
+ ClearLines ( ) ;
399
423
//get the daughters line and its daughters.
400
424
Dictionary < string , double > daughters = lib . GetDaughters ( ( string ) nuc [ "NAME" ] ) ;
401
425
//generate a string for the nuclides incuding the daughters
@@ -459,7 +483,8 @@ public void SetLines(DataRow nuc, DataRow peak)
459
483
/// <param name="exactName"></param>
460
484
public void SetNuclides ( string name , int id = 0 , bool exactName = false )
461
485
{
462
- matches . Tables [ "MATCHEDNUCLIDES" ] . Clear ( ) ;
486
+ //matches.Tables["MATCHEDNUCLIDES"].Clear();
487
+ ClearMatches ( ) ;
463
488
//convert the nuclide name to ensure it is good.
464
489
name = exactName ? name : lib . GetNuclideName ( name ) ;
465
490
0 commit comments