diff options
| -rw-r--r-- | Software/DB/Tango.mdf | bin | 75497472 -> 75497472 bytes | |||
| -rw-r--r-- | Software/DB/Tango_log.ldf | bin | 1572864 -> 1572864 bytes | |||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Threading/IDispatcherProvider.cs | 12 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Threading/DefaultDispetcherProvider.cs | 20 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Core/ExtendedObject.cs | 51 |
5 files changed, 74 insertions, 9 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex ed4d61e76..cd5c2cf3e 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 90c771cf6..6b75579c8 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Threading/IDispatcherProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Threading/IDispatcherProvider.cs index 4152d0cb9..27a5d1ab1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Threading/IDispatcherProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Threading/IDispatcherProvider.cs @@ -6,9 +6,21 @@ using System.Threading.Tasks; namespace Tango.PPC.Common.Threading { + /// <summary> + /// Represents a mechanism for invoking actions on the main application thread. + /// </summary> public interface IDispatcherProvider { + /// <summary> + /// Invokes the specified action asynchronously. + /// </summary> + /// <param name="action">The action.</param> void Invoke(Action action); + + /// <summary> + /// Invokes the specified action synchronously. + /// </summary> + /// <param name="action">The action.</param> void InvokeSync(Action action); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Threading/DefaultDispetcherProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Threading/DefaultDispetcherProvider.cs index c33233573..0051ca329 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Threading/DefaultDispetcherProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Threading/DefaultDispetcherProvider.cs @@ -8,20 +8,36 @@ using Tango.PPC.Common.Threading; namespace Tango.PPC.UI.Threading { + /// <summary> + /// Represents the default PPC <see cref="IDispatcherProvider"/> which will invoke action on the current application dispatcher. + /// </summary> + /// <seealso cref="Tango.PPC.Common.Threading.IDispatcherProvider" /> public class DefaultDispetcherProvider : IDispatcherProvider { private Dispatcher _dispatcher; - public DefaultDispetcherProvider(Dispatcher dispacther) + /// <summary> + /// Initializes a new instance of the <see cref="DefaultDispetcherProvider"/> class. + /// </summary> + /// <param name="dispatcher">The dispatcher.</param> + public DefaultDispetcherProvider(Dispatcher dispatcher) { - _dispatcher = dispacther; + _dispatcher = dispatcher; } + /// <summary> + /// Invokes the specified action asynchronously. + /// </summary> + /// <param name="action">The action.</param> public void Invoke(Action action) { _dispatcher.BeginInvoke(action); } + /// <summary> + /// Invokes the specified action synchronously. + /// </summary> + /// <param name="action">The action.</param> public void InvokeSync(Action action) { _dispatcher.Invoke(action); diff --git a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs index cafafef4f..03ac703ae 100644 --- a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs +++ b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs @@ -23,6 +23,16 @@ namespace Tango.Core public class ExtendedObject : INotifyPropertyChanged { /// <summary> + /// Gets or sets a value indicating whether to globally disable property changed on extended objects. + /// </summary> + public static bool DisablePropertyChanged { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to globally disable UI invokations on extended objects. + /// </summary> + public static bool DisableUIInvokation { get; set; } + + /// <summary> /// Occurs when after InvalidateRelayCommands is called. /// </summary> [field: NonSerialized] @@ -60,7 +70,10 @@ namespace Tango.Core /// <param name="propName">Name of the property.</param> protected virtual void RaisePropertyChanged(String propName) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName)); + if (!DisablePropertyChanged) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName)); + } } /// <summary> @@ -69,7 +82,10 @@ namespace Tango.Core /// <param name="propName">Name of the property.</param> protected virtual void RaisePropertyChangedAuto([CallerMemberName] string caller = null) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(caller)); + if (!DisablePropertyChanged) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(caller)); + } } /// <summary> @@ -77,7 +93,7 @@ namespace Tango.Core /// </summary> protected virtual void InvalidateRelayCommands() { - Application.Current.Dispatcher.BeginInvoke(new Action(() => + InvokeUI(() => { foreach (var prop in this.GetType().GetProperties().Where(x => x.PropertyType == typeof(RelayCommand))) { @@ -90,7 +106,7 @@ namespace Tango.Core } RelayCommandsInvalidated?.Invoke(this, new EventArgs()); - })); + }); } /// <summary> @@ -109,7 +125,14 @@ namespace Tango.Core /// <param name="action">The action.</param> protected virtual void InvokeUI(Action action) { - Application.Current.Dispatcher.BeginInvoke(action); + if (!DisableUIInvokation) + { + Application.Current.Dispatcher.BeginInvoke(action); + } + else + { + action(); + } } /// <summary> @@ -118,7 +141,14 @@ namespace Tango.Core /// <param name="action">The action.</param> protected virtual void InvokeUIOnIdle(Action action) { - Application.Current.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle); + if (!DisableUIInvokation) + { + Application.Current.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle); + } + else + { + action(); + } } /// <summary> @@ -127,7 +157,14 @@ namespace Tango.Core /// <param name="action">The action.</param> protected virtual void InvokeUINow(Action action) { - Application.Current.Dispatcher.Invoke(action); + if (!DisableUIInvokation) + { + Application.Current.Dispatcher.Invoke(action); + } + else + { + action(); + } } } } |
