19
19
using Rubberduck . VBEditor . SafeComWrappers ;
20
20
using System . Windows ;
21
21
using Rubberduck . Parsing . UIContext ;
22
+ using Rubberduck . Templates ;
22
23
using Rubberduck . UI . UnitTesting . Commands ;
23
24
using Rubberduck . VBEditor . SafeComWrappers . Abstract ;
24
25
@@ -36,7 +37,7 @@ public sealed class CodeExplorerViewModel : ViewModelBase, IDisposable
36
37
private readonly WindowSettings _windowSettings ;
37
38
private readonly IUiDispatcher _uiDispatcher ;
38
39
private readonly IVBE _vbe ;
39
-
40
+ private readonly ITemplateProvider _templateProvider ;
40
41
private static readonly Logger Logger = LogManager . GetCurrentClassLogger ( ) ;
41
42
42
43
public CodeExplorerViewModel (
@@ -46,7 +47,8 @@ public CodeExplorerViewModel(
46
47
IConfigProvider < GeneralSettings > generalSettingsProvider ,
47
48
IConfigProvider < WindowSettings > windowSettingsProvider ,
48
49
IUiDispatcher uiDispatcher ,
49
- IVBE vbe )
50
+ IVBE vbe ,
51
+ ITemplateProvider templateProvider )
50
52
{
51
53
_folderHelper = folderHelper ;
52
54
_state = state ;
@@ -55,6 +57,7 @@ public CodeExplorerViewModel(
55
57
_windowSettingsProvider = windowSettingsProvider ;
56
58
_uiDispatcher = uiDispatcher ;
57
59
_vbe = vbe ;
60
+ _templateProvider = templateProvider ;
58
61
59
62
if ( generalSettingsProvider != null )
60
63
{
@@ -93,6 +96,14 @@ public CodeExplorerViewModel(
93
96
} , param => ! SortByCodeOrder ) ;
94
97
}
95
98
99
+ public ObservableCollection < Template > BuiltInTemplates =>
100
+ new ObservableCollection < Template > ( _templateProvider . GetTemplates ( ) . Where ( t => ! t . IsUserDefined )
101
+ . OrderBy ( t => t . Name ) ) ;
102
+
103
+ public ObservableCollection < Template > UserDefinedTemplates =>
104
+ new ObservableCollection < Template > ( _templateProvider . GetTemplates ( ) . Where ( t => t . IsUserDefined )
105
+ . OrderBy ( t => t . Name ) ) ;
106
+
96
107
private CodeExplorerItemViewModel _selectedItem ;
97
108
public CodeExplorerItemViewModel SelectedItem
98
109
{
@@ -533,7 +544,8 @@ public double FontSize
533
544
public AddUserDocumentCommand AddUserDocumentCommand { get ; set ; }
534
545
public AddTestModuleCommand AddTestModuleCommand { get ; set ; }
535
546
public AddTestModuleWithStubsCommand AddTestModuleWithStubsCommand { get ; set ; }
536
- public CommandBase AddPredeclaredClassModuleCommand { get ; set ; }
547
+ //public CommandBase AddPredeclaredClassModuleCommand { get; set; }
548
+ public AddTemplateCommand AddTemplateCommand { get ; set ; }
537
549
public CommandBase OpenDesignerCommand { get ; set ; }
538
550
public CommandBase OpenProjectPropertiesCommand { get ; set ; }
539
551
public SetAsStartupProjectCommand SetAsStartupProjectCommand { get ; set ; }
0 commit comments