@@ -35,51 +35,51 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
35
35
36
36
var reparseCommand = commands . OfType < ReparseCommand > ( ) . SingleOrDefault ( ) ;
37
37
38
- _refreshCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) ,
38
+ RefreshCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) ,
39
39
reparseCommand == null ? ( Action < object > ) ( o => { } ) :
40
40
o => reparseCommand . Execute ( o ) ,
41
41
o => ! IsBusy && reparseCommand != null && reparseCommand . CanExecute ( o ) ) ;
42
42
43
- _navigateCommand = commands . OfType < UI . CodeExplorer . Commands . NavigateCommand > ( ) . SingleOrDefault ( ) ;
43
+ NavigateCommand = commands . OfType < UI . CodeExplorer . Commands . NavigateCommand > ( ) . SingleOrDefault ( ) ;
44
44
45
- _addTestModuleCommand = commands . OfType < UI . CodeExplorer . Commands . AddTestModuleCommand > ( ) . SingleOrDefault ( ) ;
46
- _addStdModuleCommand = commands . OfType < AddStdModuleCommand > ( ) . SingleOrDefault ( ) ;
47
- _addClassModuleCommand = commands . OfType < AddClassModuleCommand > ( ) . SingleOrDefault ( ) ;
48
- _addUserFormCommand = commands . OfType < AddUserFormCommand > ( ) . SingleOrDefault ( ) ;
45
+ AddTestModuleCommand = commands . OfType < UI . CodeExplorer . Commands . AddTestModuleCommand > ( ) . SingleOrDefault ( ) ;
46
+ AddStdModuleCommand = commands . OfType < AddStdModuleCommand > ( ) . SingleOrDefault ( ) ;
47
+ AddClassModuleCommand = commands . OfType < AddClassModuleCommand > ( ) . SingleOrDefault ( ) ;
48
+ AddUserFormCommand = commands . OfType < AddUserFormCommand > ( ) . SingleOrDefault ( ) ;
49
49
50
- _openDesignerCommand = commands . OfType < OpenDesignerCommand > ( ) . SingleOrDefault ( ) ;
51
- _openProjectPropertiesCommand = commands . OfType < OpenProjectPropertiesCommand > ( ) . SingleOrDefault ( ) ;
52
- _renameCommand = commands . OfType < RenameCommand > ( ) . SingleOrDefault ( ) ;
53
- _indenterCommand = commands . OfType < IndentCommand > ( ) . SingleOrDefault ( ) ;
50
+ OpenDesignerCommand = commands . OfType < OpenDesignerCommand > ( ) . SingleOrDefault ( ) ;
51
+ OpenProjectPropertiesCommand = commands . OfType < OpenProjectPropertiesCommand > ( ) . SingleOrDefault ( ) ;
52
+ RenameCommand = commands . OfType < RenameCommand > ( ) . SingleOrDefault ( ) ;
53
+ IndenterCommand = commands . OfType < IndentCommand > ( ) . SingleOrDefault ( ) ;
54
54
55
- _findAllReferencesCommand = commands . OfType < UI . CodeExplorer . Commands . FindAllReferencesCommand > ( ) . SingleOrDefault ( ) ;
56
- _findAllImplementationsCommand = commands . OfType < UI . CodeExplorer . Commands . FindAllImplementationsCommand > ( ) . SingleOrDefault ( ) ;
55
+ FindAllReferencesCommand = commands . OfType < UI . CodeExplorer . Commands . FindAllReferencesCommand > ( ) . SingleOrDefault ( ) ;
56
+ FindAllImplementationsCommand = commands . OfType < UI . CodeExplorer . Commands . FindAllImplementationsCommand > ( ) . SingleOrDefault ( ) ;
57
57
58
- _collapseAllSubnodesCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteCollapseNodes ) ;
59
- _expandAllSubnodesCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteExpandNodes ) ;
58
+ CollapseAllSubnodesCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteCollapseNodes ) ;
59
+ ExpandAllSubnodesCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteExpandNodes ) ;
60
60
61
- _importCommand = commands . OfType < ImportCommand > ( ) . SingleOrDefault ( ) ;
62
- _exportCommand = commands . OfType < ExportCommand > ( ) . SingleOrDefault ( ) ;
61
+ ImportCommand = commands . OfType < ImportCommand > ( ) . SingleOrDefault ( ) ;
62
+ ExportCommand = commands . OfType < ExportCommand > ( ) . SingleOrDefault ( ) ;
63
63
_externalRemoveCommand = commands . OfType < RemoveCommand > ( ) . SingleOrDefault ( ) ;
64
64
if ( _externalRemoveCommand != null )
65
65
{
66
- _removeCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteRemoveComand , _externalRemoveCommand . CanExecute ) ;
66
+ RemoveCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteRemoveComand , _externalRemoveCommand . CanExecute ) ;
67
67
}
68
68
69
- _printCommand = commands . OfType < PrintCommand > ( ) . SingleOrDefault ( ) ;
69
+ PrintCommand = commands . OfType < PrintCommand > ( ) . SingleOrDefault ( ) ;
70
70
71
- _commitCommand = commands . OfType < CommitCommand > ( ) . SingleOrDefault ( ) ;
72
- _undoCommand = commands . OfType < UndoCommand > ( ) . SingleOrDefault ( ) ;
71
+ CommitCommand = commands . OfType < CommitCommand > ( ) . SingleOrDefault ( ) ;
72
+ UndoCommand = commands . OfType < UndoCommand > ( ) . SingleOrDefault ( ) ;
73
73
74
- _copyResultsCommand = commands . OfType < CopyResultsCommand > ( ) . SingleOrDefault ( ) ;
74
+ CopyResultsCommand = commands . OfType < CopyResultsCommand > ( ) . SingleOrDefault ( ) ;
75
75
76
- _setNameSortCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , param =>
76
+ SetNameSortCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , param =>
77
77
{
78
78
SortByName = ( bool ) param ;
79
79
SortBySelection = ! ( bool ) param ;
80
80
} ) ;
81
81
82
- _setSelectionSortCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , param =>
82
+ SetSelectionSortCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , param =>
83
83
{
84
84
SortBySelection = ( bool ) param ;
85
85
SortByName = ! ( bool ) param ;
@@ -141,14 +141,11 @@ public bool SortBySelection
141
141
}
142
142
}
143
143
144
- private readonly CommandBase _copyResultsCommand ;
145
- public CommandBase CopyResultsCommand { get { return _copyResultsCommand ; } }
144
+ public CommandBase CopyResultsCommand { get ; }
146
145
147
- private readonly CommandBase _setNameSortCommand ;
148
- public CommandBase SetNameSortCommand { get { return _setNameSortCommand ; } }
146
+ public CommandBase SetNameSortCommand { get ; }
149
147
150
- private readonly CommandBase _setSelectionSortCommand ;
151
- public CommandBase SetSelectionSortCommand { get { return _setSelectionSortCommand ; } }
148
+ public CommandBase SetSelectionSortCommand { get ; }
152
149
153
150
private bool _sortByType = true ;
154
151
public bool SortByType
@@ -193,9 +190,8 @@ public string PanelTitle
193
190
194
191
var declaration = SelectedItem . GetSelectedDeclaration ( ) ;
195
192
196
- var nameWithDeclarationType = declaration . IdentifierName +
197
- string . Format ( " - ({0})" , RubberduckUI . ResourceManager . GetString (
198
- "DeclarationType_" + declaration . DeclarationType , CultureInfo . CurrentUICulture ) ) ;
193
+ var nameWithDeclarationType = declaration . IdentifierName +
194
+ $ " - ({ RubberduckUI . ResourceManager . GetString ( "DeclarationType_" + declaration . DeclarationType , CultureInfo . CurrentUICulture ) } )";
199
195
200
196
if ( string . IsNullOrEmpty ( declaration . AsTypeName ) )
201
197
{
@@ -228,9 +224,9 @@ public string Description
228
224
}
229
225
}
230
226
231
- public bool CanExecuteIndenterCommand { get { return IndenterCommand . CanExecute ( SelectedItem ) ; } }
232
- public bool CanExecuteRenameCommand { get { return RenameCommand . CanExecute ( SelectedItem ) ; } }
233
- public bool CanExecuteFindAllReferencesCommand { get { return FindAllReferencesCommand . CanExecute ( SelectedItem ) ; } }
227
+ public bool CanExecuteIndenterCommand => IndenterCommand . CanExecute ( SelectedItem ) ;
228
+ public bool CanExecuteRenameCommand => RenameCommand . CanExecute ( SelectedItem ) ;
229
+ public bool CanExecuteFindAllReferencesCommand => FindAllReferencesCommand . CanExecute ( SelectedItem ) ;
234
230
235
231
private ObservableCollection < CodeExplorerItemViewModel > _projects ;
236
232
public ObservableCollection < CodeExplorerItemViewModel > Projects
@@ -407,14 +403,11 @@ private void SetErrorState(CodeExplorerItemViewModel itemNode, IVBComponent comp
407
403
return ;
408
404
}
409
405
410
- if ( node is CodeExplorerComponentViewModel )
406
+ var componentNode = node as CodeExplorerComponentViewModel ;
407
+ if ( componentNode ? . GetSelectedDeclaration ( ) . QualifiedName . QualifiedModuleName . Component . Equals ( component ) == true )
411
408
{
412
- var componentNode = ( CodeExplorerComponentViewModel ) node ;
413
- if ( componentNode . GetSelectedDeclaration ( ) . QualifiedName . QualifiedModuleName . Component . Equals ( component ) )
414
- {
415
- componentNode . IsErrorState = true ;
416
- _errorStateSet = true ;
417
- }
409
+ componentNode . IsErrorState = true ;
410
+ _errorStateSet = true ;
418
411
}
419
412
}
420
413
}
@@ -446,65 +439,36 @@ private void SwitchNodeState(CodeExplorerItemViewModel node, bool expandedState)
446
439
}
447
440
}
448
441
449
- private readonly CommandBase _refreshCommand ;
450
- public CommandBase RefreshCommand { get { return _refreshCommand ; } }
451
-
452
- private readonly CommandBase _navigateCommand ;
453
- public CommandBase NavigateCommand { get { return _navigateCommand ; } }
454
-
455
- private readonly CommandBase _addTestModuleCommand ;
456
- public CommandBase AddTestModuleCommand { get { return _addTestModuleCommand ; } }
457
-
458
- private readonly CommandBase _addStdModuleCommand ;
459
- public CommandBase AddStdModuleCommand { get { return _addStdModuleCommand ; } }
460
-
461
- private readonly CommandBase _addClassModuleCommand ;
462
- public CommandBase AddClassModuleCommand { get { return _addClassModuleCommand ; } }
463
-
464
- private readonly CommandBase _addUserFormCommand ;
465
- public CommandBase AddUserFormCommand { get { return _addUserFormCommand ; } }
466
-
467
- private readonly CommandBase _openDesignerCommand ;
468
- public CommandBase OpenDesignerCommand { get { return _openDesignerCommand ; } }
469
-
470
- private readonly CommandBase _openProjectPropertiesCommand ;
471
- public CommandBase OpenProjectPropertiesCommand { get { return _openProjectPropertiesCommand ; } }
472
-
473
- private readonly CommandBase _renameCommand ;
474
- public CommandBase RenameCommand { get { return _renameCommand ; } }
475
-
476
- private readonly CommandBase _indenterCommand ;
477
- public CommandBase IndenterCommand { get { return _indenterCommand ; } }
442
+ public CommandBase RefreshCommand { get ; }
478
443
479
- private readonly CommandBase _findAllReferencesCommand ;
480
- public CommandBase FindAllReferencesCommand { get { return _findAllReferencesCommand ; } }
444
+ public CommandBase NavigateCommand { get ; }
481
445
482
- private readonly CommandBase _findAllImplementationsCommand ;
483
- public CommandBase FindAllImplementationsCommand { get { return _findAllImplementationsCommand ; } }
446
+ public CommandBase AddTestModuleCommand { get ; }
447
+ public CommandBase AddStdModuleCommand { get ; }
448
+ public CommandBase AddClassModuleCommand { get ; }
449
+ public CommandBase AddUserFormCommand { get ; }
484
450
485
- private readonly CommandBase _collapseAllSubnodesCommand ;
486
- public CommandBase CollapseAllSubnodesCommand { get { return _collapseAllSubnodesCommand ; } }
451
+ public CommandBase OpenDesignerCommand { get ; }
452
+ public CommandBase OpenProjectPropertiesCommand { get ; }
487
453
488
- private readonly CommandBase _expandAllSubnodesCommand ;
489
- public CommandBase ExpandAllSubnodesCommand { get { return _expandAllSubnodesCommand ; } }
454
+ public CommandBase RenameCommand { get ; }
490
455
491
- private readonly CommandBase _importCommand ;
492
- public CommandBase ImportCommand { get { return _importCommand ; } }
456
+ public CommandBase IndenterCommand { get ; }
493
457
494
- private readonly CommandBase _exportCommand ;
495
- public CommandBase ExportCommand { get { return _exportCommand ; } }
458
+ public CommandBase FindAllReferencesCommand { get ; }
459
+ public CommandBase FindAllImplementationsCommand { get ; }
496
460
497
- private readonly CommandBase _removeCommand ;
498
- public CommandBase RemoveCommand { get { return _removeCommand ; } }
461
+ public CommandBase CollapseAllSubnodesCommand { get ; }
462
+ public CommandBase ExpandAllSubnodesCommand { get ; }
499
463
500
- private readonly CommandBase _printCommand ;
501
- public CommandBase PrintCommand { get { return _printCommand ; } }
464
+ public CommandBase ImportCommand { get ; }
465
+ public CommandBase ExportCommand { get ; }
466
+ public CommandBase RemoveCommand { get ; }
502
467
503
- private readonly CommandBase _commitCommand ;
504
- public CommandBase CommitCommand { get { return _commitCommand ; } }
468
+ public CommandBase PrintCommand { get ; }
505
469
506
- private readonly CommandBase _undoCommand ;
507
- public CommandBase UndoCommand { get { return _undoCommand ; } }
470
+ public CommandBase CommitCommand { get ; }
471
+ public CommandBase UndoCommand { get ; }
508
472
509
473
private readonly CommandBase _externalRemoveCommand ;
510
474
0 commit comments