From 2c8da378c82e5181f0566a564de529ab7ef96f4f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 23 Aug 2018 09:45:01 +0300 Subject: Improvements to machine studio view models and navigation system. Improvements to tech board selection and edit modes handling. --- .../Threading/DefaultDispatcherProvider.cs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs new file mode 100644 index 000000000..611dca6b9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Threading; +using Tango.MachineStudio.Common.Threading; + +namespace Tango.MachineStudio.UI.Threading +{ + /// + /// Represents the default PPC which will invoke action on the current application dispatcher. + /// + /// + public class DefaultDispatcherProvider : IDispatcherProvider + { + private Dispatcher _dispatcher; + + /// + /// Initializes a new instance of the class. + /// + /// The dispatcher. + public DefaultDispatcherProvider(Dispatcher dispatcher) + { + _dispatcher = dispatcher; + } + + /// + /// Invokes the specified action asynchronously. + /// + /// The action. + public void Invoke(Action action) + { + _dispatcher.BeginInvoke(action); + } + + /// + /// Invokes the specified action synchronously. + /// + /// The action. + public void InvokeSync(Action action) + { + _dispatcher.Invoke(action); + } + } +} -- cgit v1.3.1