diff --git a/source2/VSIP/Cosmos.VS.Windows/AssemblyUC.xaml.cs b/source2/VSIP/Cosmos.VS.Windows/AssemblyUC.xaml.cs index 13abdd635..1e0131d46 100644 --- a/source2/VSIP/Cosmos.VS.Windows/AssemblyUC.xaml.cs +++ b/source2/VSIP/Cosmos.VS.Windows/AssemblyUC.xaml.cs @@ -638,8 +638,8 @@ namespace Cosmos.VS.Windows { Log("DoUpdate"); mLines.Clear(); - - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, + + System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() { if (mData.Length == 0) diff --git a/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs b/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs index b977591fb..eee1195b1 100644 --- a/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs +++ b/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs @@ -86,16 +86,6 @@ namespace Cosmos.VS.Windows 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. // 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. @@ -116,7 +106,7 @@ namespace Cosmos.VS.Windows 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() { var xWindow = FindWindow(aWindowType); @@ -128,42 +118,22 @@ namespace Cosmos.VS.Windows 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) { - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - ShowWindow(typeof(InternalTW)); - } - ); + ShowWindow(typeof(InternalTW)); } 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) { - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - ShowWindow(typeof(StackTW)); - } - ); + ShowWindow(typeof(StackTW)); } private void ShowWindowAll(object aCommand, EventArgs e) @@ -228,30 +198,15 @@ namespace Cosmos.VS.Windows break; case Debugger2Windows.Stack: - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - UpdateWindow(typeof(StackTW), "STACK", xMsg); - } - ); + UpdateWindow(typeof(StackTW), "STACK", xMsg); break; case Debugger2Windows.Frame: - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - UpdateWindow(typeof(StackTW), "FRAME", xMsg); - } - ); + UpdateWindow(typeof(StackTW), "FRAME", xMsg); break; case Debugger2Windows.Registers: - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - UpdateWindow(typeof(RegistersTW), null, xMsg); - } - ); + UpdateWindow(typeof(RegistersTW), null, xMsg); break; case Debugger2Windows.Quit: @@ -271,7 +226,7 @@ namespace Cosmos.VS.Windows break; case Debugger2Windows.OutputPane: - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, + System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() { Global.OutputPane.OutputString(System.Text.Encoding.UTF8.GetString(xMsg)); @@ -280,7 +235,7 @@ namespace Cosmos.VS.Windows break; case Debugger2Windows.OutputClear: - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, + System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() { Global.OutputPane.Clear(); diff --git a/source2/VSIP/Cosmos.VS.Windows/DebuggerUC.cs b/source2/VSIP/Cosmos.VS.Windows/DebuggerUC.cs index 0ba9d90d4..74659c95a 100644 --- a/source2/VSIP/Cosmos.VS.Windows/DebuggerUC.cs +++ b/source2/VSIP/Cosmos.VS.Windows/DebuggerUC.cs @@ -26,13 +26,8 @@ namespace Cosmos.VS.Windows public virtual void Update(string aTag, byte[] aData) { - Dispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - mData = aData; - DoUpdate(aTag); - } - ); + mData = aData; + DoUpdate(aTag); } protected virtual void DoUpdate(string aTag) diff --git a/source2/VSIP/Cosmos.VS.Windows/RegistersUC.xaml.cs b/source2/VSIP/Cosmos.VS.Windows/RegistersUC.xaml.cs index d65694c08..eab1882c7 100644 --- a/source2/VSIP/Cosmos.VS.Windows/RegistersUC.xaml.cs +++ b/source2/VSIP/Cosmos.VS.Windows/RegistersUC.xaml.cs @@ -95,7 +95,7 @@ namespace Cosmos.VS.Windows // ESP 32 // EIP 36 // - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, + System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() { if (mData == null) diff --git a/source2/VSIP/Cosmos.VS.Windows/StackUC.xaml.cs b/source2/VSIP/Cosmos.VS.Windows/StackUC.xaml.cs index 5d03b26b1..e838b7203 100644 --- a/source2/VSIP/Cosmos.VS.Windows/StackUC.xaml.cs +++ b/source2/VSIP/Cosmos.VS.Windows/StackUC.xaml.cs @@ -51,48 +51,32 @@ namespace Cosmos.VS.Windows public override void Update(string aTag, byte[] aData) { - Dispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() + if (aTag == "FRAME") { - if (aTag == "FRAME") - { - mData = aData; - } - else - { - stackData = aData; - } - DoUpdate(aTag); + mData = aData; } - ); + else + { + stackData = aData; + } + DoUpdate(aTag); } protected override void DoUpdate(string aTag) { if (aTag == "STACK") { - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - UpdateStack(stackData); - } - ); - + UpdateStack(stackData); } else if (aTag == "FRAME") { - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, - (Action)delegate() - { - UpdateFrame(mData); - } - ); + UpdateFrame(mData); } } public void UpdateFrame(byte[] aData) { - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, + System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() { if (aData == null) @@ -125,7 +109,7 @@ namespace Cosmos.VS.Windows public void UpdateStack(byte[] aData) { - System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, + System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate() { if (aData == null) @@ -153,7 +137,6 @@ namespace Cosmos.VS.Windows ); } - public override byte[] GetCurrentState() { byte[] aFrameData = mData == null ? new byte[0] : mData;