Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FOR REVIEW] Visual Studio Extension for managing Bot Configuration #174

Open
wants to merge 54 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0e71452
Visual Studio Extension for creating Bot files
gasper-az Jan 18, 2019
2a5be90
Add method for writing Json content in .bot file
gasper-az Jan 18, 2019
06edcb3
Fix issue when adding a second bot file to the project
gasper-az Jan 18, 2019
2f75fc7
Reload the project programmatically to show the recently added .bot file
gasper-az Jan 18, 2019
d860eda
Add copyright to files
gasper-az Jan 21, 2019
509b962
Apply stylecop rules
gasper-az Jan 21, 2019
7d2a733
Updated GeneralSettings
gasper-az Jan 22, 2019
76192d2
Delete unnecessary files
gasper-az Jan 22, 2019
313649e
Add missing DLL
gasper-az Jan 23, 2019
636670d
Bot File will be created with MSBot init command
gasper-az Jan 29, 2019
a1ae836
Add MSBot command manager
gasper-az Jan 29, 2019
bc95812
Update NugetPackage Version
gasper-az Jan 29, 2019
8c1cae4
Update wizard UI to get Environment theme color.
Bill7zz Jan 31, 2019
4a56e6c
Add cancel button handle click method
Bill7zz Jan 31, 2019
8772b71
Update buttons position
Bill7zz Jan 31, 2019
0a0fe94
Minor refactor
gasper-az Jan 30, 2019
33a0646
Add validation to check if MSBot is installed
gasper-az Jan 30, 2019
a41334a
Fix
gasper-az Jan 30, 2019
8561d5d
Add prerequisites validation
gasper-az Jan 31, 2019
7b45a7a
Add logic for creating bots with endpoints
gasper-az Jan 31, 2019
785f12d
Reload programatically the project
gasper-az Jan 31, 2019
264c980
Fix buttons position
gasper-az Jan 31, 2019
d4223e7
Update Wizard UI
Bill7zz Feb 1, 2019
8454dfd
Add checkbox control for Encrypt
Bill7zz Feb 1, 2019
a15a81d
Update set max and min windows size
Bill7zz Feb 4, 2019
b939d02
Update Improve Styling format
Bill7zz Feb 4, 2019
6889811
Merge branch 'feature/bot-file-creator-wizard' into dev/bot-file-crea…
Bill7zz Feb 4, 2019
6d14d1b
Update Implement encryption module
Bill7zz Feb 5, 2019
450debe
Fix missing endpoint command
Bill7zz Feb 5, 2019
5d95ebe
Update cancel button content to close after create an encrypting file
Bill7zz Feb 5, 2019
5c50b1c
Fix Typo in TextBox message
Bill7zz Feb 6, 2019
068a10f
Update endpoint module to have appId and appPassword
Bill7zz Feb 8, 2019
6f056d7
Add fody property changed notification
Bill7zz Feb 8, 2019
ec941f7
Add view model logic
Bill7zz Feb 8, 2019
5acf5b9
Update UI to bind with BotConfigurationViewModel
Bill7zz Feb 8, 2019
697aa55
Add view model logic
Bill7zz Feb 8, 2019
07ec5dc
Add AppID & AppPassword
gasper-az Feb 8, 2019
53783f7
Update bot creation Wizard implement MVVM pattern
Bill7zz Feb 12, 2019
1039994
Update improved style bindings
Bill7zz Feb 12, 2019
7b6bd0a
Refactor
gasper-az Feb 11, 2019
f8ba33e
Refactor
gasper-az Feb 12, 2019
522946f
Refactor
gasper-az Feb 12, 2019
b253e8d
Minor refactor
gasper-az Feb 12, 2019
93f3c80
Minor changes
gasper-az Feb 12, 2019
3a805bc
Add Models directory
Bill7zz Feb 13, 2019
fc1878b
Add FileSystemService class to add the bot file to the project
Bill7zz Feb 13, 2019
f0dbef0
Update ViewModel class to implement the FileSystemServices
Bill7zz Feb 13, 2019
5fcfc59
Update BotFileCreator name to BotConfiguration
Bill7zz Feb 13, 2019
f1b51aa
Update project directory and names
Bill7zz Feb 13, 2019
a7a582e
Update move directory from manx repository
Bill7zz Feb 14, 2019
6a4bf0b
Merge remote-tracking branch 'origin-tmp-repo/dev/refactor' into bot-…
Bill7zz Feb 14, 2019
aff1654
Move BotFileConfigurationWizard folder
Bill7zz Feb 14, 2019
12ae2ca
Add Endpoint list element
Bill7zz Feb 15, 2019
e91361c
Add Endpoint list styles
Bill7zz Feb 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions generators/vsix-vs-win/BotConfigurationWizard/BotFileCreator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2041
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotFileCreator", "BotFileCreator\BotFileCreator.csproj", "{90E69D82-3623-4AE8-9F25-3E4BB7362508}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90E69D82-3623-4AE8-9F25-3E4BB7362508}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90E69D82-3623-4AE8-9F25-3E4BB7362508}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90E69D82-3623-4AE8-9F25-3E4BB7362508}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90E69D82-3623-4AE8-9F25-3E4BB7362508}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {63432931-989E-4E26-9D1B-F9C39DF3BD91}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace BotFileCreator
{
using Microsoft.VisualStudio.PlatformUI;

public class BaseDialogWindow : DialogWindow
{
public BaseDialogWindow()
{
this.HasMaximizeButton = true;
this.HasMinimizeButton = true;
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for StyleCop.Analyzers" Description="Code analysis rules for StyleCop.Analyzers.csproj." ToolsVersion="15.0">
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
<Rule Id="AvoidAsyncVoid" Action="Warning" />
<Rule Id="UseConfigureAwait" Action="Warning" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
<Rule Id="CS0105" Action="None" />
<Rule Id="CS8019" Action="Warning" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
<Rule Id="IDE0003" Action="None" />
<Rule Id="IDE0005" Action="Warning" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1129" Action="None" />
<Rule Id="SA1200" Action="None" />
<Rule Id="SA1214" Action="None" />
<Rule Id="SA1305" Action="Warning" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1412" Action="Warning" />
<Rule Id="SA1600" Action="None" />
<Rule Id="SA1609" Action="Warning" />
<Rule Id="SA1633" Action="None" />
</Rules>
</RuleSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace BotFileCreator
{
using System;
using System.ComponentModel.Design;
using System.Runtime.InteropServices;
using EnvDTE;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Task = System.Threading.Tasks.Task;

/// <summary>
/// Command handler
/// </summary>
internal sealed class BotFileCreatorCommand
{
/// <summary>
/// Command ID.
/// </summary>
public const int CommandId = 0x0100;

/// <summary>
/// Command menu group (command set GUID).
/// </summary>
public static readonly Guid CommandSet = new Guid("d217be97-bc71-44be-ae8e-9a297f2af054");

/// <summary>
/// VS Package that provides this command, not null.
/// </summary>
private readonly AsyncPackage package;

/// <summary>
/// Initializes a new instance of the <see cref="BotFileCreatorCommand"/> class.
/// Adds our command handlers for menu (commands must exist in the command table file)
/// </summary>
/// <param name="package">Owner package, not null.</param>
/// <param name="commandService">Command service to add command to, not null.</param>
private BotFileCreatorCommand(AsyncPackage package, OleMenuCommandService commandService)
{
this.package = package ?? throw new ArgumentNullException(nameof(package));
commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new MenuCommand(this.Execute, menuCommandID);
commandService.AddCommand(menuItem);
}

/// <summary>
/// Gets the instance of the command.
/// </summary>
public static BotFileCreatorCommand Instance
{
get;
private set;
}

/// <summary>
/// Gets the service provider from the owner package.
/// </summary>
private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider
{
get
{
return this.package;
}
}

/// <summary>
/// Initializes the singleton instance of the command.
/// </summary>
/// <param name="package">Owner package, not null.</param>
public static async Task InitializeAsync(AsyncPackage package)
{
// Switch to the main thread - the call to AddCommand in BotFileCreatorCommand's constructor requires
// the UI thread.
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
Instance = new BotFileCreatorCommand(package, commandService);
}

/// <summary>
/// This function is the callback used to execute the command when the menu item is clicked.
/// See the constructor to see how the menu item is associated with this function using
/// OleMenuCommandService service and MenuCommand class.
/// </summary>
/// <param name="sender">Event sender.</param>
/// <param name="e">Event args.</param>
private void Execute(object sender, EventArgs e)
{
ThreadHelper.ThrowIfNotOnUIThread();

/*
* This code gets the Project's name from where the Wizard/Visual Studio Extension is being called
* Is necessary to call these methods from the main thread
*/
IntPtr hierarchyPointer, selectionContainerPointer;
object selectedObject = null;
IVsMultiItemSelect multiItemSelect;
uint projectItemId;

IVsMonitorSelection monitorSelection = (IVsMonitorSelection)Package.GetGlobalService(typeof(SVsShellMonitorSelection));

monitorSelection.GetCurrentSelection(out hierarchyPointer, out projectItemId, out multiItemSelect, out selectionContainerPointer);

IVsHierarchy selectedHierarchy = Marshal.GetTypedObjectForIUnknown(hierarchyPointer, typeof(IVsHierarchy)) as IVsHierarchy;

if (selectedHierarchy != null)
{
ErrorHandler.ThrowOnFailure(selectedHierarchy.GetProperty(projectItemId, (int)__VSHPROPID.VSHPROPID_ExtObject, out selectedObject));
}

Project selectedProject = selectedObject as Project;

string projectPath = selectedProject.FullName;

// Adds the project name to the Settings File to use it later.
GeneralSettings.Default.ProjectName = projectPath;

// Starts the wizard
var botFileCreatorWizard = new BotFileCreationWizard();

botFileCreatorWizard.ShowDialog();

selectedProject.DTE.ExecuteCommand("Project.UnloadProject");
selectedProject.DTE.ExecuteCommand("Project.ReloadProject");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace BotFileCreator
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.VisualStudio.Shell;
using Task = System.Threading.Tasks.Task;

/// <summary>
/// This is the class that implements the package exposed by this assembly.
/// </summary>
/// <remarks>
/// <para>
/// The minimum requirement for a class to be considered a valid package for Visual Studio
/// is to implement the IVsPackage interface and register itself with the shell.
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
/// to do it: it derives from the Package class that provides the implementation of the
/// IVsPackage interface and uses the registration attributes defined in the framework to
/// register itself and its components with the shell. These attributes tell the pkgdef creation
/// utility what data to put into .pkgdef file.
/// </para>
/// <para>
/// To get loaded into VS, the package must be referred by &lt;Asset Type="Microsoft.VisualStudio.VsPackage" ...&gt; in .vsixmanifest file.
/// </para>
/// </remarks>
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About
[Guid(BotFileCreatorPackage.PackageGuidString)]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
[ProvideMenuResource("Menus.ctmenu", 1)]
public sealed class BotFileCreatorPackage : AsyncPackage
{
/// <summary>
/// BotFileCreatorPackage GUID string.
/// </summary>
public const string PackageGuidString = "81cae91a-c890-4be2-8970-ff09441817cf";

/// <summary>
/// Initializes a new instance of the <see cref="BotFileCreatorPackage"/> class.
/// </summary>
public BotFileCreatorPackage()
{
// Inside this method you can place any initialization code that does not require
// any Visual Studio service because at this point the package object is created but
// not sited yet inside Visual Studio environment. The place to do all the other
// initialization is the Initialize method.
}

#region Package Members

/// <summary>
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initialization code that rely on services provided by VisualStudio.
/// </summary>
/// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
/// <param name="progress">A provider for progress updates.</param>
/// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
// When initialized asynchronously, the current thread may be a background thread at this point.
// Do any initialization that requires the UI thread after switching to the UI thread.
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
await BotFileCreatorCommand.InitializeAsync(this);
}

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- This is the file that defines the actual layout and type of the commands.
It is divided in different sections (e.g. command definition, command
placement, ...), with each defining a specific set of properties.
See the comment before each section for more details about how to
use it. -->

<!-- The VSCT compiler (the tool that translates this file into the binary
format that VisualStudio will consume) has the ability to run a preprocessor
on the vsct file; this preprocessor is (usually) the C++ preprocessor, so
it is possible to define includes and macros with the same syntax used
in C++ files. Using this ability of the compiler here, we include some files
defining some of the constants that we will use inside the file. -->

<!--This is the file that defines the IDs for all the commands exposed by VisualStudio. -->
<Extern href="stdidcmd.h"/>

<!--This header contains the command ids for the menus provided by the shell. -->
<Extern href="vsshlids.h"/>

<!--The Commands section is where commands, menus, and menu groups are defined.
This section uses a Guid to identify the package that provides the command defined inside it. -->
<Commands package="guidBotFileCreatorPackage">
<!-- Inside this section we have different sub-sections: one for the menus, another
for the menu groups, one for the buttons (the actual commands), one for the combos
and the last one for the bitmaps used. Each element is identified by a command id that
is a unique pair of guid and numeric identifier; the guid part of the identifier is usually
called "command set" and is used to group different command inside a logically related
group; your package should define its own command set in order to avoid collisions
with command ids defined by other packages. -->

<!-- In this section you can define new menu groups. A menu group is a container for
other menus or buttons (commands); from a visual point of view you can see the
group as the part of a menu contained between two lines. The parent of a group
must be a menu. -->
<Groups>
<Group guid="guidBotFileCreatorPackageCmdSet" id="BotFileCreatorMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/>
</Group>
</Groups>

<!--Buttons section. -->
<!--This section defines the elements the user can interact with, like a menu command or a button
or combo box in a toolbar. -->
<Buttons>
<!--To define a menu group you have to specify its ID, the parent menu and its display priority.
The command is visible and enabled by default. If you need to change the visibility, status, etc, you can use
the CommandFlag node.
You can add more than one CommandFlag node e.g.:
<CommandFlag>DefaultInvisible</CommandFlag>
<CommandFlag>DynamicVisibility</CommandFlag>
If you do not want an image next to your command, remove the Icon node /> -->
<Button guid="guidBotFileCreatorPackageCmdSet" id="BotFileCreatorCommandId" priority="0x0100" type="Button">
<Parent guid="guidBotFileCreatorPackageCmdSet" id="BotFileCreatorMenuGroup" />
<Strings>
<ButtonText>Create Bot File</ButtonText>
</Strings>
</Button>
</Buttons>

<!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
<Bitmaps>
<!-- The bitmap id is defined in a way that is a little bit different from the others:
the declaration starts with a guid for the bitmap strip, then there is the resource id of the
bitmap strip containing the bitmaps and then there are the numeric ids of the elements used
inside a button definition. An important aspect of this declaration is that the element id
must be the actual index (1-based) of the bitmap inside the bitmap strip. -->
<!--<Bitmap guid="guidImages" href="Resources\BotFileCreatorCommand.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough"/>-->
</Bitmaps>
</Commands>

<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="guidBotFileCreatorPackage" value="{81cae91a-c890-4be2-8970-ff09441817cf}" />

<!-- This is the guid used to group the menu commands together -->
<GuidSymbol name="guidBotFileCreatorPackageCmdSet" value="{d217be97-bc71-44be-ae8e-9a297f2af054}">
<IDSymbol name="BotFileCreatorMenuGroup" value="0x1020" />
<IDSymbol name="BotFileCreatorCommandId" value="0x0100" />
</GuidSymbol>

<GuidSymbol name="guidImages" value="{194289af-6a1c-4704-aa4d-a7d237ecbc53}" >
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol>
</Symbols>
</CommandTable>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
Loading