-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVsEnvironmentCommandBase.cs
More file actions
84 lines (73 loc) · 3.64 KB
/
VsEnvironmentCommandBase.cs
File metadata and controls
84 lines (73 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//*****************************************************************************
//* Code Factory SDK
//* Copyright (c) 2023 CodeFactory, LLC
//*****************************************************************************
using System.Threading.Tasks;
using CodeFactory.Logging;
namespace CodeFactory.VisualStudio
{
/// <summary>
/// Base implementation for a environment command that supports integration with the Visual studio IDE environment directly.
/// </summary>
/// <typeparam name="TModel">The target visual studio model type to be returned from the visual studio environment command.</typeparam>
public abstract class VsEnviromentCommandBase<TModel> : IVsEnvironmentCommand<TModel> where TModel : class
{
/// <summary>
/// Backing field for the property <see cref="CommandTitle"/>
/// </summary>
protected readonly string _commandTitle;
/// <summary>
/// Backing field for the property <see cref="CommandDescription"/>
/// </summary>
protected readonly string _commandDescription;
/// <summary>
/// Backing field for the property <see cref="CommandType"/>
/// </summary>
private readonly VsCommandType _commandType;
/// <summary>
/// Logging method that is used by the command to log to the code factory logging framework.
/// </summary>
protected readonly ILogger _logger;
/// <summary>
/// Backing field for the property <see cref="VisualStudioActions"/>
/// </summary>
private readonly IVsActions _visualStudioActions;
/// <summary>
/// Base constructor used it initialize a visual studio command.
/// </summary>
/// <param name="logger">The code factory logger to be used by the logger.</param>
/// <param name="commands">The global visual studio commands that can be used by this visual studio command.</param>
/// <param name="commandType">The target type of command being created. </param>
/// <param name="commandTitle">The title displayed in visual studio for this command.</param>
/// <param name="commandDescription">A brief description of the purpose of this command.</param>
protected VsEnviromentCommandBase(ILogger logger, IVsActions commands, VsCommandType commandType,string commandTitle, string commandDescription)
{
_logger = logger;
_commandType = commandType;
_visualStudioActions = commands;
_commandTitle = commandTitle;
_commandDescription = commandDescription;
}
/// <summary>
/// Action title that will be displayed within visual studio.
/// </summary>
public string CommandTitle => _commandTitle;
/// <summary>
/// An optional discription that discribes what this factory command is intended for.
/// </summary>
public string CommandDescription => _commandDescription;
/// <summary>
/// The target type of command that is being loaded.
/// </summary>
public VsCommandType CommandType => _commandType;
/// <summary>
/// Global visual studio commands that can be accessed from this visual studio command.
/// </summary>
public IVsActions VisualStudioActions => _visualStudioActions;
/// <summary>
/// Code factory framework calls this method when the command has been executed.
/// </summary>
/// <param name="result">The code factory model that has generated and provided to the command to process.</param>
public abstract Task ExecuteCommandAsync(TModel result);
}
}