mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
reduce Dispatcher.Invoke calls, use now the Application.Current.Dispatcher, fix exception on FindWindow, assembler stepping is working for me without mterwood's changes
This commit is contained in:
parent
66133c640d
commit
10052cd8d8
5 changed files with 26 additions and 93 deletions
|
|
@ -639,7 +639,7 @@ namespace Cosmos.VS.Windows
|
||||||
Log("DoUpdate");
|
Log("DoUpdate");
|
||||||
mLines.Clear();
|
mLines.Clear();
|
||||||
|
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||||
(Action)delegate()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
if (mData.Length == 0)
|
if (mData.Length == 0)
|
||||||
|
|
|
||||||
|
|
@ -86,16 +86,6 @@ namespace Cosmos.VS.Windows
|
||||||
|
|
||||||
private ToolWindowPane2 FindWindow(Type aWindowType)
|
private ToolWindowPane2 FindWindow(Type aWindowType)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (System.Reflection.TargetInvocationException e)
|
|
||||||
{
|
|
||||||
Exception innerException = e.InnerException;
|
|
||||||
Global.OutputPane.OutputString(innerException.Message + "\r\n");
|
|
||||||
Global.OutputPane.OutputString(innerException.StackTrace + "\r\n");
|
|
||||||
}
|
|
||||||
// Get the instance number 0 of this tool window.
|
// Get the instance number 0 of this tool window.
|
||||||
// Our windows are single instance so this instance will be the only one.
|
// Our windows are single instance so this instance will be 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.
|
||||||
|
|
@ -116,7 +106,7 @@ namespace Cosmos.VS.Windows
|
||||||
|
|
||||||
private void UpdateWindow(Type aWindowType, string aTag, byte[] aData)
|
private void UpdateWindow(Type aWindowType, string aTag, byte[] aData)
|
||||||
{
|
{
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||||
(Action)delegate()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
var xWindow = FindWindow(aWindowType);
|
var xWindow = FindWindow(aWindowType);
|
||||||
|
|
@ -127,44 +117,24 @@ namespace Cosmos.VS.Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowWindowAssembly(object aCommand, EventArgs e)
|
private void ShowWindowAssembly(object aCommand, EventArgs e)
|
||||||
{
|
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
ShowWindow(typeof(AssemblyTW));
|
ShowWindow(typeof(AssemblyTW));
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowWindowInternal(object aCommand, EventArgs e)
|
private void ShowWindowInternal(object aCommand, EventArgs e)
|
||||||
{
|
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
ShowWindow(typeof(InternalTW));
|
ShowWindow(typeof(InternalTW));
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowWindowRegisters(object aCommand, EventArgs e)
|
private void ShowWindowRegisters(object aCommand, EventArgs e)
|
||||||
{
|
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
ShowWindow(typeof(RegistersTW));
|
ShowWindow(typeof(RegistersTW));
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowWindowStack(object aCommand, EventArgs e)
|
private void ShowWindowStack(object aCommand, EventArgs e)
|
||||||
{
|
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
ShowWindow(typeof(StackTW));
|
ShowWindow(typeof(StackTW));
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowWindowAll(object aCommand, EventArgs e)
|
private void ShowWindowAll(object aCommand, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
@ -228,30 +198,15 @@ namespace Cosmos.VS.Windows
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Debugger2Windows.Stack:
|
case Debugger2Windows.Stack:
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
|
||||||
UpdateWindow(typeof(StackTW), "STACK", xMsg);
|
UpdateWindow(typeof(StackTW), "STACK", xMsg);
|
||||||
}
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Debugger2Windows.Frame:
|
case Debugger2Windows.Frame:
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
|
||||||
UpdateWindow(typeof(StackTW), "FRAME", xMsg);
|
UpdateWindow(typeof(StackTW), "FRAME", xMsg);
|
||||||
}
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Debugger2Windows.Registers:
|
case Debugger2Windows.Registers:
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
|
||||||
UpdateWindow(typeof(RegistersTW), null, xMsg);
|
UpdateWindow(typeof(RegistersTW), null, xMsg);
|
||||||
}
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Debugger2Windows.Quit:
|
case Debugger2Windows.Quit:
|
||||||
|
|
@ -271,7 +226,7 @@ namespace Cosmos.VS.Windows
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Debugger2Windows.OutputPane:
|
case Debugger2Windows.OutputPane:
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||||
(Action)delegate()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
Global.OutputPane.OutputString(System.Text.Encoding.UTF8.GetString(xMsg));
|
Global.OutputPane.OutputString(System.Text.Encoding.UTF8.GetString(xMsg));
|
||||||
|
|
@ -280,7 +235,7 @@ namespace Cosmos.VS.Windows
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Debugger2Windows.OutputClear:
|
case Debugger2Windows.OutputClear:
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||||
(Action)delegate()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
Global.OutputPane.Clear();
|
Global.OutputPane.Clear();
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,10 @@ namespace Cosmos.VS.Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update(string aTag, byte[] aData)
|
public virtual void Update(string aTag, byte[] aData)
|
||||||
{
|
|
||||||
Dispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
mData = aData;
|
mData = aData;
|
||||||
DoUpdate(aTag);
|
DoUpdate(aTag);
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void DoUpdate(string aTag)
|
protected virtual void DoUpdate(string aTag)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ namespace Cosmos.VS.Windows
|
||||||
// ESP 32
|
// ESP 32
|
||||||
// EIP 36
|
// EIP 36
|
||||||
//
|
//
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||||
(Action)delegate()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
if (mData == null)
|
if (mData == null)
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,6 @@ namespace Cosmos.VS.Windows
|
||||||
|
|
||||||
|
|
||||||
public override void Update(string aTag, byte[] aData)
|
public override void Update(string aTag, byte[] aData)
|
||||||
{
|
|
||||||
Dispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
if (aTag == "FRAME")
|
if (aTag == "FRAME")
|
||||||
{
|
{
|
||||||
|
|
@ -64,35 +61,22 @@ namespace Cosmos.VS.Windows
|
||||||
}
|
}
|
||||||
DoUpdate(aTag);
|
DoUpdate(aTag);
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void DoUpdate(string aTag)
|
protected override void DoUpdate(string aTag)
|
||||||
{
|
{
|
||||||
if (aTag == "STACK")
|
if (aTag == "STACK")
|
||||||
{
|
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
UpdateStack(stackData);
|
UpdateStack(stackData);
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (aTag == "FRAME")
|
else if (aTag == "FRAME")
|
||||||
{
|
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
|
||||||
(Action)delegate()
|
|
||||||
{
|
{
|
||||||
UpdateFrame(mData);
|
UpdateFrame(mData);
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateFrame(byte[] aData)
|
public void UpdateFrame(byte[] aData)
|
||||||
{
|
{
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||||
(Action)delegate()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
if (aData == null)
|
if (aData == null)
|
||||||
|
|
@ -125,7 +109,7 @@ namespace Cosmos.VS.Windows
|
||||||
|
|
||||||
public void UpdateStack(byte[] aData)
|
public void UpdateStack(byte[] aData)
|
||||||
{
|
{
|
||||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
|
System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||||
(Action)delegate()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
if (aData == null)
|
if (aData == null)
|
||||||
|
|
@ -153,7 +137,6 @@ namespace Cosmos.VS.Windows
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override byte[] GetCurrentState()
|
public override byte[] GetCurrentState()
|
||||||
{
|
{
|
||||||
byte[] aFrameData = mData == null ? new byte[0] : mData;
|
byte[] aFrameData = mData == null ? new byte[0] : mData;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue