mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
Cleanup of debug window registration code.
This commit is contained in:
parent
c7a0921085
commit
a6c23ad599
1 changed files with 30 additions and 71 deletions
|
|
@ -79,37 +79,23 @@ namespace Cosmos.VS.Windows {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowCosmosVSInternalToolWindow(object sender, EventArgs e) {
|
private void ShowWindowInternal(object sender, EventArgs e) {
|
||||||
// Get the instance number 0 of this tool window. This window is single instance so this instance
|
if (ShowWindow(typeof(InternalTW))) {
|
||||||
// is actually the only one.
|
UpdateInternal();
|
||||||
// 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(InternalTW), 0, true);
|
|
||||||
if ((null == window) || (null == window.Frame)) {
|
|
||||||
throw new NotSupportedException(Resources.CanNotCreateWindow);
|
|
||||||
}
|
}
|
||||||
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
|
|
||||||
if (windowFrame.IsVisible() == 0) UpdateInternal();
|
|
||||||
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowCosmosVSRegistersToolWindow(object sender, EventArgs e) {
|
private void ShowWindowRegisters(object sender, EventArgs e) {
|
||||||
ToolWindowPane window = this.FindToolWindow(typeof(RegistersTW), 0, true);
|
if (ShowWindow(typeof(RegistersTW))) {
|
||||||
if ((null == window) || (null == window.Frame)) {
|
UpdateRegisters();
|
||||||
throw new NotSupportedException(Resources.CanNotCreateWindow);
|
|
||||||
}
|
}
|
||||||
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
|
|
||||||
if (windowFrame.IsVisible() == 0) UpdateRegisters();
|
|
||||||
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowCosmosVSStackToolWindow(object sender, EventArgs e) {
|
private void ShowWindowStack(object sender, EventArgs e) {
|
||||||
ToolWindowPane window = this.FindToolWindow(typeof(StackTW), 0, true);
|
if (ShowWindow(typeof(StackTW))) {
|
||||||
if ((null == window) || (null == window.Frame)) {
|
UpdateStack();
|
||||||
throw new NotSupportedException(Resources.CanNotCreateWindow);
|
UpdateFrame();
|
||||||
}
|
}
|
||||||
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
|
|
||||||
if (windowFrame.IsVisible() == 0) UpdateStackFrame();
|
|
||||||
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShowWindow(Type aWindowType) {
|
private bool ShowWindow(Type aWindowType) {
|
||||||
|
|
@ -128,18 +114,10 @@ namespace Cosmos.VS.Windows {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowWindowAll(object sender, EventArgs e) {
|
private void ShowWindowAll(object sender, EventArgs e) {
|
||||||
if (ShowWindow(typeof(AssemblyTW))) {
|
ShowWindowAssembly(sender, e);
|
||||||
UpdateAssembly();
|
ShowWindowRegisters(sender, e);
|
||||||
}
|
ShowWindowStack(sender, e);
|
||||||
if (ShowWindow(typeof(RegistersTW))) {
|
ShowWindowInternal(sender, e);
|
||||||
UpdateRegisters();
|
|
||||||
}
|
|
||||||
if (ShowWindow(typeof(StackTW))) {
|
|
||||||
UpdateStackFrame();
|
|
||||||
}
|
|
||||||
if (ShowWindow(typeof(InternalTW))) {
|
|
||||||
UpdateInternal();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overriden Package Implementation
|
// Overriden Package Implementation
|
||||||
|
|
@ -158,17 +136,14 @@ namespace Cosmos.VS.Windows {
|
||||||
MenuCommand CosmosVSAssemblyToolWindowMenuCommand = new MenuCommand(ShowWindowAssembly, CosmosVSAssemblyToolWindowCommandID);
|
MenuCommand CosmosVSAssemblyToolWindowMenuCommand = new MenuCommand(ShowWindowAssembly, CosmosVSAssemblyToolWindowCommandID);
|
||||||
mcs.AddCommand(CosmosVSAssemblyToolWindowMenuCommand);
|
mcs.AddCommand(CosmosVSAssemblyToolWindowMenuCommand);
|
||||||
|
|
||||||
// Create the command for the registers tool window
|
|
||||||
CommandID CosmosVSRegistersToolWindowCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosRegisters);
|
CommandID CosmosVSRegistersToolWindowCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosRegisters);
|
||||||
MenuCommand CosmosVSRegistersToolWindowMenuCommand = new MenuCommand(ShowCosmosVSRegistersToolWindow, CosmosVSRegistersToolWindowCommandID);
|
MenuCommand CosmosVSRegistersToolWindowMenuCommand = new MenuCommand(ShowWindowRegisters, CosmosVSRegistersToolWindowCommandID);
|
||||||
mcs.AddCommand(CosmosVSRegistersToolWindowMenuCommand);
|
mcs.AddCommand(CosmosVSRegistersToolWindowMenuCommand);
|
||||||
|
|
||||||
// Create the command for the stack tool window
|
|
||||||
CommandID CosmosVSStackToolWindowCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosStack);
|
CommandID CosmosVSStackToolWindowCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosStack);
|
||||||
MenuCommand CosmosVSStackToolWindowMenuCommand = new MenuCommand(ShowCosmosVSStackToolWindow, CosmosVSStackToolWindowCommandID);
|
MenuCommand CosmosVSStackToolWindowMenuCommand = new MenuCommand(ShowWindowStack, CosmosVSStackToolWindowCommandID);
|
||||||
mcs.AddCommand(CosmosVSStackToolWindowMenuCommand);
|
mcs.AddCommand(CosmosVSStackToolWindowMenuCommand);
|
||||||
|
|
||||||
// Create the command to show all tool windows
|
|
||||||
CommandID CosmosVSShowAllToolWindowsCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosShowAll);
|
CommandID CosmosVSShowAllToolWindowsCommandID = new CommandID(GuidList.guidCosmos_VS_WindowsCmdSet, (int)PkgCmdIDList.cmdidCosmosShowAll);
|
||||||
MenuCommand CosmosVSShowAllToolWindowMenuCommand = new MenuCommand(ShowWindowAll, CosmosVSShowAllToolWindowsCommandID);
|
MenuCommand CosmosVSShowAllToolWindowMenuCommand = new MenuCommand(ShowWindowAll, CosmosVSShowAllToolWindowsCommandID);
|
||||||
mcs.AddCommand(CosmosVSShowAllToolWindowMenuCommand);
|
mcs.AddCommand(CosmosVSShowAllToolWindowMenuCommand);
|
||||||
|
|
@ -186,38 +161,24 @@ namespace Cosmos.VS.Windows {
|
||||||
xCmd = mCommand.Dequeue();
|
xCmd = mCommand.Dequeue();
|
||||||
xMsg = mMessage.Dequeue();
|
xMsg = mMessage.Dequeue();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (xCmd) {
|
switch (xCmd) {
|
||||||
case DwMsg.Noop:
|
case DwMsg.Noop:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DwMsg.Stack:
|
case DwMsg.Stack:
|
||||||
if (StackTW.mUC != null) {
|
|
||||||
StackTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
|
||||||
StackTW.mUC.UpdateStack(xMsg);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
StackUC.mStackData = xMsg;
|
StackUC.mStackData = xMsg;
|
||||||
}
|
UpdateStack();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DwMsg.Frame:
|
case DwMsg.Frame:
|
||||||
if (StackTW.mUC != null) {
|
|
||||||
StackTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
|
||||||
StackTW.mUC.UpdateFrame(xMsg);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
StackUC.mFrameData = xMsg;
|
StackUC.mFrameData = xMsg;
|
||||||
}
|
UpdateFrame();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DwMsg.Registers:
|
case DwMsg.Registers:
|
||||||
if (RegistersTW.mUC != null) {
|
|
||||||
RegistersTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
|
||||||
RegistersTW.mUC.Update(xMsg);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
RegistersUC.mData = xMsg;
|
RegistersUC.mData = xMsg;
|
||||||
}
|
UpdateRegisters();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DwMsg.Quit:
|
case DwMsg.Quit:
|
||||||
|
|
@ -225,19 +186,13 @@ namespace Cosmos.VS.Windows {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DwMsg.AssemblySource:
|
case DwMsg.AssemblySource:
|
||||||
if (AssemblyTW.mUC != null) {
|
|
||||||
AssemblyTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
|
||||||
AssemblyTW.mUC.Update(xMsg);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
AssemblyUC.mData = xMsg;
|
AssemblyUC.mData = xMsg;
|
||||||
}
|
UpdateAssembly();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DwMsg.Pong:
|
case DwMsg.Pong:
|
||||||
System.Windows.MessageBox.Show("Pong!");
|
System.Windows.MessageBox.Show("Pong!");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -259,14 +214,18 @@ namespace Cosmos.VS.Windows {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateStackFrame() {
|
private void UpdateStack() {
|
||||||
if (StackTW.mUC != null) {
|
if (StackTW.mUC != null) {
|
||||||
if ((StackUC.mStackData != null) && (StackUC.mStackData.Length > 0)) {
|
if ((StackUC.mStackData != null) && (StackUC.mStackData.Length > 0)) {
|
||||||
StackTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
StackTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
||||||
StackTW.mUC.UpdateStack(StackUC.mStackData);
|
StackTW.mUC.UpdateStack(StackUC.mStackData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateFrame() {
|
||||||
|
if (StackTW.mUC != null) {
|
||||||
if ((StackUC.mFrameData != null) && (StackUC.mFrameData.Length > 0)) {
|
if ((StackUC.mFrameData != null) && (StackUC.mFrameData.Length > 0)) {
|
||||||
StackTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
StackTW.mUC.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() {
|
||||||
StackTW.mUC.UpdateFrame(StackUC.mFrameData);
|
StackTW.mUC.UpdateFrame(StackUC.mFrameData);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue