28
28
using System . Windows . Forms ;
29
29
using Analogy . DataTypes ;
30
30
using Analogy . Forms ;
31
+ using ChangeEventArgs = DevExpress . XtraEditors . Controls . ChangeEventArgs ;
31
32
32
33
namespace Analogy
33
34
{
@@ -209,24 +210,21 @@ private void UCLogs_Load(object sender, EventArgs e)
209
210
}
210
211
} ) ;
211
212
212
- LogGrid . RowCountChanged += ( s , arg ) =>
213
- {
214
- if ( Settings . AutoScrollToLastMessage && ! IsDisposed )
215
- {
216
- BeginInvoke ( new MethodInvoker ( ( ) =>
217
- {
218
- LogGrid . MoveLast ( ) ;
219
- LogGrid . MakeRowVisible ( LogGrid . FocusedRowHandle ) ;
220
- } ) ) ;
221
-
222
- }
223
- } ;
213
+
224
214
225
215
226
216
gridControl . DataSource = _messageData . DefaultView ;
227
217
_bookmarkedMessages = Utils . DataTableConstructor ( ) ;
228
218
gridControlBookmarkedMessages . DataSource = _bookmarkedMessages ;
229
219
220
+ if ( Settings . SaveSearchFilters )
221
+ {
222
+ txtbInclude . Text = string . IsNullOrEmpty ( Settings . IncludeText ) || Settings . IncludeText == txtbInclude . Properties . NullText ? null : Settings . IncludeText ;
223
+ txtbExclude . Text = string . IsNullOrEmpty ( Settings . ExcludeText ) || Settings . ExcludeText == txtbExclude . Properties . NullText ? null : Settings . ExcludeText ; ;
224
+ txtbSource . Text = string . IsNullOrEmpty ( Settings . SourceText ) || Settings . SourceText == txtbSource . Properties . NullText ? null : Settings . SourceText ;
225
+ txtbModule . Text = string . IsNullOrEmpty ( Settings . ModuleText ) || Settings . ModuleText == txtbModule . Properties . NullText ? null : Settings . ModuleText ;
226
+ }
227
+
230
228
gridControl . Focus ( ) ;
231
229
}
232
230
private void rgSearchMode_SelectedIndexChanged ( object s , EventArgs e )
@@ -286,6 +284,19 @@ private void SetupEventsHandlers()
286
284
bbiDatetiemFilterFrom . ItemClick += tsmiDateFilterNewer_Click ;
287
285
#endregion
288
286
287
+ LogGrid . RowCountChanged += ( s , arg ) =>
288
+ {
289
+ if ( Settings . AutoScrollToLastMessage && ! IsDisposed )
290
+ {
291
+ BeginInvoke ( new MethodInvoker ( ( ) =>
292
+ {
293
+ LogGrid . MoveLast ( ) ;
294
+ LogGrid . MakeRowVisible ( LogGrid . FocusedRowHandle ) ;
295
+ } ) ) ;
296
+
297
+ }
298
+ } ;
299
+
289
300
gridControl . KeyUp += ( s , e ) =>
290
301
{
291
302
Keys excludeModifier = e . KeyCode & ~ Keys . Control & ~ Keys . Shift & ~ Keys . Alt ;
@@ -407,9 +418,15 @@ private void SetupEventsHandlers()
407
418
408
419
}
409
420
} ;
421
+
422
+ txtbInclude . EditValueChanged += EditValueChanged ;
423
+ txtbExclude . EditValueChanged += EditValueChanged ;
424
+ txtbSource . EditValueChanged += EditValueChanged ;
425
+ txtbModule . EditValueChanged += EditValueChanged ;
410
426
txtbInclude . TextChanged += async ( s , e ) =>
411
427
{
412
- if ( OldTextInclude . Equals ( txtbInclude . Text ) )
428
+ if ( OldTextInclude . Equals ( txtbInclude . Text ) ||
429
+ txtbInclude . Text . Equals ( txtbInclude . Properties . NullText ) )
413
430
{
414
431
return ;
415
432
}
@@ -419,6 +436,7 @@ private void SetupEventsHandlers()
419
436
if ( string . IsNullOrEmpty ( txtbInclude . Text ) )
420
437
{
421
438
ceIncludeText . Checked = false ;
439
+ txtbInclude . EditValue = null ;
422
440
return ;
423
441
}
424
442
@@ -441,7 +459,8 @@ private void SetupEventsHandlers()
441
459
} ;
442
460
txtbExclude . TextChanged += async ( s , e ) =>
443
461
{
444
- if ( OldTextExclude . Equals ( txtbExclude . Text ) )
462
+ if ( OldTextExclude . Equals ( txtbExclude . Text ) ||
463
+ txtbExclude . Text . Equals ( txtbExclude . Properties . NullText ) )
445
464
{
446
465
return ;
447
466
}
@@ -451,6 +470,7 @@ private void SetupEventsHandlers()
451
470
if ( string . IsNullOrEmpty ( txtbExclude . Text ) )
452
471
{
453
472
ceExcludeText . Checked = false ;
473
+ txtbExclude . EditValue = null ;
454
474
return ;
455
475
}
456
476
@@ -460,9 +480,11 @@ private void SetupEventsHandlers()
460
480
461
481
txtbSource . TextChanged += async ( s , e ) =>
462
482
{
463
- if ( string . IsNullOrEmpty ( txtbSource . Text ) )
483
+ if ( string . IsNullOrEmpty ( txtbSource . Text ) ||
484
+ txtbSource . Text . Equals ( txtbSource . Properties . NullText ) )
464
485
{
465
486
ceSources . Checked = false ;
487
+ txtbSource . EditValue = null ;
466
488
}
467
489
else
468
490
{
@@ -478,9 +500,11 @@ private void SetupEventsHandlers()
478
500
479
501
txtbModule . TextChanged += async ( s , e ) =>
480
502
{
481
- if ( string . IsNullOrEmpty ( txtbModule . Text ) )
503
+ if ( string . IsNullOrEmpty ( txtbModule . Text ) ||
504
+ txtbModule . Text . Equals ( txtbModule . Properties . NullText ) )
482
505
{
483
506
ceModulesProcess . Checked = false ;
507
+ txtbModule . EditValue = null ;
484
508
}
485
509
else
486
510
{
@@ -505,6 +529,16 @@ private void SetupEventsHandlers()
505
529
506
530
}
507
531
532
+ private void EditValueChanged ( object sender , EventArgs e )
533
+ {
534
+
535
+ if ( sender is BaseEdit edit && e is ChangingEventArgs change && change . NewValue == string . Empty )
536
+ {
537
+ edit . EditValue = null ;
538
+ }
539
+ }
540
+
541
+
508
542
private void MainView_Layout ( object sender , EventArgs e )
509
543
{
510
544
try
@@ -867,15 +901,6 @@ private void LoadUISettings()
867
901
gridControl . MainView . RestoreLayoutFromXml ( Settings . LogGridFileName ) ;
868
902
gridControlBookmarkedMessages . MainView . RestoreLayoutFromXml ( Settings . LogGridFileName ) ;
869
903
}
870
-
871
- if ( Settings . SaveSearchFilters )
872
- {
873
- txtbInclude . Text = Settings . IncludeText ;
874
- txtbExclude . Text = Settings . ExcludeText ;
875
- txtbSource . Text = Settings . SourceText ;
876
- txtbModule . Text = Settings . ModuleText ;
877
- }
878
-
879
904
btswitchRefreshLog . Checked = true ;
880
905
gridColumnCategory . Visible = false ;
881
906
LogGrid . BestFitColumns ( ) ;
@@ -1507,7 +1532,7 @@ private void AddExtraColumnsToLogGrid(GridView gridView, AnalogyLogMessage messa
1507
1532
if ( ! gridView . Columns . Select ( g => g . FieldName ) . Contains ( info . Key ) )
1508
1533
{
1509
1534
gridView . Columns . Add ( new GridColumn ( )
1510
- { Caption = info . Key , FieldName = info . Key , Name = info . Key , Visible = true } ) ;
1535
+ { Caption = info . Key , FieldName = info . Key , Name = info . Key , Visible = true } ) ;
1511
1536
CurrentColumnsFields . Add ( ( info . Key , info . Key ) ) ;
1512
1537
IncludeFilterCriteriaUIOptions . Add ( new FilterCriteriaUIOption ( info . Key , info . Key , false ) ) ;
1513
1538
ExcludeFilterCriteriaUIOptions . Add ( new FilterCriteriaUIOption ( info . Key , info . Key , false ) ) ;
@@ -1644,6 +1669,7 @@ private void UpdatePage(DataTable page)
1644
1669
1645
1670
public void FilterResults ( string module )
1646
1671
{
1672
+ if ( IsDisposed ) return ;
1647
1673
txtbModule . Text = module ;
1648
1674
FilterResults ( ) ;
1649
1675
}
@@ -3023,11 +3049,13 @@ private void tsmiAddCommentToMessage_Click(object sender, EventArgs e)
3023
3049
3024
3050
private void txtbInclude_KeyPress ( object sender , KeyPressEventArgs e )
3025
3051
{
3052
+ if ( IsDisposed ) return ;
3026
3053
xtcFilters . SelectedTabPage = xtpFiltersIncludes ;
3027
3054
}
3028
3055
3029
3056
private void txtbExclude_EditValueChanged ( object sender , EventArgs e )
3030
3057
{
3058
+ if ( IsDisposed ) return ;
3031
3059
xtcFilters . SelectedTabPage = xtpFiltersExclude ;
3032
3060
}
3033
3061
}
0 commit comments