mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 14:02:19 +00:00
This commit is contained in:
parent
dd71c1b8a4
commit
30da530345
10 changed files with 151 additions and 34 deletions
|
|
@ -117,11 +117,15 @@
|
||||||
</COMReference>
|
</COMReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="MyControl.xaml.cs">
|
<Compile Include="CosmosVSAssembly_UserControl.xaml.cs">
|
||||||
<DependentUpon>MyControl.xaml</DependentUpon>
|
<DependentUpon>CosmosVSAssembly_UserControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="MyToolWindow.cs" />
|
<Compile Include="CosmosVSRegisters_UserControl.xaml.cs">
|
||||||
|
<DependentUpon>CosmosVSRegisters_UserControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="CosmosVSAssembly_ToolWindow.cs" />
|
||||||
<Compile Include="Guids.cs" />
|
<Compile Include="Guids.cs" />
|
||||||
|
<Compile Include="CosmosVSRegisters_ToolWindow.cs" />
|
||||||
<Compile Include="Resources.Designer.cs">
|
<Compile Include="Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|
@ -154,6 +158,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<VSCTCompile Include="Cosmos.VS.Windows.vsct">
|
<VSCTCompile Include="Cosmos.VS.Windows.vsct">
|
||||||
<ResourceName>Menus.ctmenu</ResourceName>
|
<ResourceName>Menus.ctmenu</ResourceName>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
</VSCTCompile>
|
</VSCTCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -164,7 +169,11 @@
|
||||||
<Content Include="Resources\Package.ico" />
|
<Content Include="Resources\Package.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="MyControl.xaml">
|
<Page Include="CosmosVSAssembly_UserControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="CosmosVSRegisters_UserControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@
|
||||||
<!--Definition of some VSCT specific constants. In this sample we use it for the IDs inside the guidOfficeIcon group. -->
|
<!--Definition of some VSCT specific constants. In this sample we use it for the IDs inside the guidOfficeIcon group. -->
|
||||||
<Extern href="msobtnid.h"/>
|
<Extern href="msobtnid.h"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--The Commands section is where we the commands, menus and menu groups are defined.
|
<!--The Commands section is where we the commands, menus and menu groups are defined.
|
||||||
This section uses a Guid to identify the package that provides the command defined inside it. -->
|
This section uses a Guid to identify the package that provides the command defined inside it. -->
|
||||||
<Commands package="guidCosmos_VS_WindowsPkg">
|
<Commands package="guidCosmos_VS_WindowsPkg">
|
||||||
|
|
@ -37,14 +34,11 @@
|
||||||
group; your package should define its own command set in order to avoid collisions
|
group; your package should define its own command set in order to avoid collisions
|
||||||
with command ids defined by other packages. -->
|
with command ids defined by other packages. -->
|
||||||
|
|
||||||
|
|
||||||
<!-- In this section you can define new menu groups. A menu group is a container for
|
<!-- 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
|
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
|
group as the part of a menu contained between two lines. The parent of a group
|
||||||
must be a menu. -->
|
must be a menu. -->
|
||||||
<Groups>
|
<Groups>
|
||||||
|
|
||||||
|
|
||||||
</Groups>
|
</Groups>
|
||||||
|
|
||||||
<!--Buttons section. -->
|
<!--Buttons section. -->
|
||||||
|
|
@ -58,8 +52,6 @@
|
||||||
<CommandFlag>DefaultInvisible</CommandFlag>
|
<CommandFlag>DefaultInvisible</CommandFlag>
|
||||||
<CommandFlag>DynamicVisibility</CommandFlag>
|
<CommandFlag>DynamicVisibility</CommandFlag>
|
||||||
If you do not want an image next to your command, remove the Icon node or set it to <Icon guid="guidOfficeIcon" id="msotcidNoIcon" /> -->
|
If you do not want an image next to your command, remove the Icon node or set it to <Icon guid="guidOfficeIcon" id="msotcidNoIcon" /> -->
|
||||||
|
|
||||||
|
|
||||||
<Button guid="guidCosmos_VS_WindowsCmdSet" id="cmdidCosmosAssembly" priority="0x0100" type="Button">
|
<Button guid="guidCosmos_VS_WindowsCmdSet" id="cmdidCosmosAssembly" priority="0x0100" type="Button">
|
||||||
<Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1"/>
|
<Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1"/>
|
||||||
<Icon guid="guidImages" id="bmpPic2" />
|
<Icon guid="guidImages" id="bmpPic2" />
|
||||||
|
|
@ -68,8 +60,14 @@
|
||||||
<ButtonText>Cosmos Assembly Window</ButtonText>
|
<ButtonText>Cosmos Assembly Window</ButtonText>
|
||||||
</Strings>
|
</Strings>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button guid="guidCosmos_VS_WindowsCmdSet" id="cmdidCosmosRegisters" priority="0x0100" type="Button">
|
||||||
|
<Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1"/>
|
||||||
|
<Icon guid="guidImages" id="bmpPic2" />
|
||||||
|
<Strings>
|
||||||
|
<CommandName>cmdidCosmosRegisters</CommandName>
|
||||||
|
<ButtonText>Cosmos Registers Window</ButtonText>
|
||||||
|
</Strings>
|
||||||
|
</Button>
|
||||||
</Buttons>
|
</Buttons>
|
||||||
|
|
||||||
<!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
|
<!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
|
||||||
|
|
@ -85,23 +83,17 @@
|
||||||
|
|
||||||
</Commands>
|
</Commands>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Symbols>
|
<Symbols>
|
||||||
<!-- This is the package guid. -->
|
<!-- This is the package guid. -->
|
||||||
<GuidSymbol name="guidCosmos_VS_WindowsPkg" value="{a82b45e9-2a89-43bd-925d-c7f0edd212aa}" />
|
<GuidSymbol name="guidCosmos_VS_WindowsPkg" value="{a82b45e9-2a89-43bd-925d-c7f0edd212aa}" />
|
||||||
|
|
||||||
<!-- This is the guid used to group the menu commands together -->
|
<!-- This is the guid used to group the menu commands together -->
|
||||||
<GuidSymbol name="guidCosmos_VS_WindowsCmdSet" value="{3d4b3f35-36e7-4cea-8acc-d9601e45c0b9}">
|
<GuidSymbol name="guidCosmos_VS_WindowsCmdSet" value="{3d4b3f35-36e7-4cea-8acc-d9601e45c0b9}">
|
||||||
|
|
||||||
<IDSymbol name="MyMenuGroup" value="0x1020" />
|
<IDSymbol name="MyMenuGroup" value="0x1020" />
|
||||||
<IDSymbol name="cmdidCosmosAssembly" value="0x0101" />
|
<IDSymbol name="cmdidCosmosAssembly" value="0x0101" />
|
||||||
|
<IDSymbol name="cmdidCosmosRegisters" value="0x0102" />
|
||||||
</GuidSymbol>
|
</GuidSymbol>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<GuidSymbol name="guidImages" value="{aa9d88d9-acd2-4f2c-ab40-92887bdce774}" >
|
<GuidSymbol name="guidImages" value="{aa9d88d9-acd2-4f2c-ab40-92887bdce774}" >
|
||||||
<IDSymbol name="bmpPic1" value="1" />
|
<IDSymbol name="bmpPic1" value="1" />
|
||||||
<IDSymbol name="bmpPic2" value="2" />
|
<IDSymbol name="bmpPic2" value="2" />
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ namespace Cosmos.Cosmos_VS_Windows
|
||||||
// This attribute is needed to let the shell know that this package exposes some menus.
|
// This attribute is needed to let the shell know that this package exposes some menus.
|
||||||
[ProvideMenuResource("Menus.ctmenu", 1)]
|
[ProvideMenuResource("Menus.ctmenu", 1)]
|
||||||
// This attribute registers a tool window exposed by this package.
|
// This attribute registers a tool window exposed by this package.
|
||||||
[ProvideToolWindow(typeof(MyToolWindow))]
|
[ProvideToolWindow(typeof(CosmosVSAssembly_ToolWindow))]
|
||||||
|
[ProvideToolWindow(typeof(CosmosVSRegisters_ToolWindow))]
|
||||||
[Guid(GuidList.guidCosmos_VS_WindowsPkgString)]
|
[Guid(GuidList.guidCosmos_VS_WindowsPkgString)]
|
||||||
public sealed class Cosmos_VS_WindowsPackage : Package
|
public sealed class Cosmos_VS_WindowsPackage : Package
|
||||||
{
|
{
|
||||||
|
|
@ -51,12 +52,12 @@ namespace Cosmos.Cosmos_VS_Windows
|
||||||
/// tool window. See the Initialize method to see how the menu item is associated to
|
/// tool window. See the Initialize method to see how the menu item is associated to
|
||||||
/// this function using the OleMenuCommandService service and the MenuCommand class.
|
/// this function using the OleMenuCommandService service and the MenuCommand class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ShowToolWindow(object sender, EventArgs e)
|
private void ShowCosmosVSAssemblyToolWindow(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Get the instance number 0 of this tool window. This window is single instance so this instance
|
// Get the instance number 0 of this tool window. This window is single instance so this instance
|
||||||
// is actually the only one.
|
// is actually the only one.
|
||||||
// The last flag is set to true so that if the tool window does not exists it will be created.
|
// The last flag is set to true so that if the tool window does not exists it will be created.
|
||||||
ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true);
|
ToolWindowPane window = this.FindToolWindow(typeof(CosmosVSAssembly_ToolWindow), 0, true);
|
||||||
if ((null == window) || (null == window.Frame))
|
if ((null == window) || (null == window.Frame))
|
||||||
{
|
{
|
||||||
throw new NotSupportedException(Resources.CanNotCreateWindow);
|
throw new NotSupportedException(Resources.CanNotCreateWindow);
|
||||||
|
|
@ -65,6 +66,19 @@ namespace Cosmos.Cosmos_VS_Windows
|
||||||
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
|
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShowCosmosVSRegistersToolWindow(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Get the instance number 0 of this tool window. This window is single instance so this instance
|
||||||
|
// is actually the only one.
|
||||||
|
// The last flag is set to true so that if the tool window does not exists it will be created.
|
||||||
|
ToolWindowPane window = this.FindToolWindow(typeof(CosmosVSRegisters_ToolWindow), 0, true);
|
||||||
|
if ((null == window) || (null == window.Frame))
|
||||||
|
{
|
||||||
|
throw new NotSupportedException(Resources.CanNotCreateWindow);
|
||||||
|
}
|
||||||
|
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
|
||||||
|
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Overriden Package Implementation
|
// Overriden Package Implementation
|
||||||
|
|
@ -84,9 +98,14 @@ namespace Cosmos.Cosmos_VS_Windows
|
||||||
if ( null != mcs )
|
if ( null != mcs )
|
||||||
{
|
{
|
||||||
// Create the command for the tool window
|
// Create the command for the tool window
|
||||||
CommandID toolwndCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosAssembly);
|
CommandID CosmosVSAssemblyToolWindowCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosAssembly);
|
||||||
MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
|
MenuCommand CosmosVSAssemblyToolWindowMenuCommand = new MenuCommand(ShowCosmosVSAssemblyToolWindow, CosmosVSAssemblyToolWindowCommandID);
|
||||||
mcs.AddCommand( menuToolWin );
|
mcs.AddCommand(CosmosVSAssemblyToolWindowMenuCommand);
|
||||||
|
|
||||||
|
// Create the command for the tool window
|
||||||
|
CommandID CosmosVSRegistersToolWindowCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosRegisters);
|
||||||
|
MenuCommand CosmosVSRegistersToolWindowMenuCommand = new MenuCommand(ShowCosmosVSRegistersToolWindow, CosmosVSRegistersToolWindowCommandID);
|
||||||
|
mcs.AddCommand(CosmosVSRegistersToolWindowMenuCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ namespace Cosmos.Cosmos_VS_Windows
|
||||||
/// implementation of the IVsUIElementPane interface.
|
/// implementation of the IVsUIElementPane interface.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Guid("f019fb29-c2c2-4d27-9abf-739533c939be")]
|
[Guid("f019fb29-c2c2-4d27-9abf-739533c939be")]
|
||||||
public class MyToolWindow : ToolWindowPane
|
public class CosmosVSAssembly_ToolWindow : ToolWindowPane
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Standard constructor for the tool window.
|
/// Standard constructor for the tool window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MyToolWindow() :
|
public CosmosVSAssembly_ToolWindow() :
|
||||||
base(null)
|
base(null)
|
||||||
{
|
{
|
||||||
// Set the window title reading it from the resources.
|
// Set the window title reading it from the resources.
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Data;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.VisualStudio.Shell.Interop;
|
||||||
|
using Microsoft.VisualStudio.Shell;
|
||||||
|
|
||||||
|
namespace Cosmos.Cosmos_VS_Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This class implements the tool window exposed by this package and hosts a user control.
|
||||||
|
///
|
||||||
|
/// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
|
||||||
|
/// usually implemented by the package implementer.
|
||||||
|
///
|
||||||
|
/// This class derives from the ToolWindowPane class provided from the MPF in order to use its
|
||||||
|
/// implementation of the IVsUIElementPane interface.
|
||||||
|
/// </summary>
|
||||||
|
[Guid("CE2A2D0F-0F1B-4A1F-A9AC-5A5F2A5E2C25")]
|
||||||
|
public class CosmosVSRegisters_ToolWindow : ToolWindowPane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Standard constructor for the tool window.
|
||||||
|
/// </summary>
|
||||||
|
public CosmosVSRegisters_ToolWindow() : base(null)
|
||||||
|
{
|
||||||
|
// Set the window title reading it from the resources.
|
||||||
|
this.Caption = "Cosmos x86 Registers Window"; // Resources.ToolWindowTitle;
|
||||||
|
// Set the image that will appear on the tab of the window frame
|
||||||
|
// when docked with an other window
|
||||||
|
// The resource ID correspond to the one defined in the resx file
|
||||||
|
// while the Index is the offset in the bitmap strip. Each image in
|
||||||
|
// the strip being 16x16.
|
||||||
|
this.BitmapResourceID = 301;
|
||||||
|
this.BitmapIndex = 1;
|
||||||
|
|
||||||
|
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
|
||||||
|
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
|
||||||
|
// the object returned by the Content property.
|
||||||
|
base.Content = new CosmosVSRegisters_UserControl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<UserControl x:Class="Cosmos.Cosmos_VS_Windows.CosmosVSRegisters_UserControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300"
|
||||||
|
Name="MyToolWindow1"
|
||||||
|
Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<TextBlock Margin="10" HorizontalAlignment="Center" Foreground="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowTextKey}}">This is a toolwindow with WPF content</TextBlock>
|
||||||
|
<Button Content="_Click Me!" Width="80" Height="80" Name="button1" Click="button1_Click" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Cosmos.Cosmos_VS_Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MyControl1.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CosmosVSRegisters_UserControl : UserControl
|
||||||
|
{
|
||||||
|
public CosmosVSRegisters_UserControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1300:SpecifyMessageBoxOptions")]
|
||||||
|
private void button1_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(string.Format(System.Globalization.CultureInfo.CurrentUICulture, "We are inside {0}.button1_Click()", this.ToString()),
|
||||||
|
"Cosmos x86 Registers Window");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,8 +6,7 @@ namespace Cosmos.Cosmos_VS_Windows
|
||||||
{
|
{
|
||||||
static class PkgCmdIDList
|
static class PkgCmdIDList
|
||||||
{
|
{
|
||||||
|
|
||||||
public const uint cmdidCosmosAssembly = 0x101;
|
public const uint cmdidCosmosAssembly = 0x101;
|
||||||
|
public const uint cmdidCosmosRegisters = 0x102;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue