diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-24 16:18:39 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-24 16:18:39 +0300 |
| commit | 1e24679bf65e42e5df96113bd1eef371036f0940 (patch) | |
| tree | bb954219f7f5ec0f6e37631cae2c6aa0ac9d184b /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications | |
| parent | a4f4b3be2917b13667217cf826c21e8bd644a8c4 (diff) | |
| download | Tango-1e24679bf65e42e5df96113bd1eef371036f0940.tar.gz Tango-1e24679bf65e42e5df96113bd1eef371036f0940.zip | |
Implemented job resume!!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 6cff1ba17..80509e6c0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -11,6 +11,7 @@ using System.Windows.Media; using Tango.Core; using System.Collections.ObjectModel; using Tango.SharedUI; +using System.Collections.Concurrent; namespace Tango.MachineStudio.UI.Notifications { @@ -21,6 +22,8 @@ namespace Tango.MachineStudio.UI.Notifications /// <seealso cref="Tango.MachineStudio.Common.Notifications.INotificationProvider" /> public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + private int _message_count = 0; + /// <summary> /// The view types /// </summary> @@ -79,6 +82,8 @@ namespace Tango.MachineStudio.UI.Notifications { MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + _message_count++; + var result = new MessageBoxWindow() { Owner = Application.Current.MainWindow, @@ -89,7 +94,13 @@ namespace Tango.MachineStudio.UI.Notifications }.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + _message_count--; + + if (_message_count == 0) + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } + return result; } @@ -377,8 +388,11 @@ namespace Tango.MachineStudio.UI.Notifications /// <param name="taskItem">The task item.</param> public void PushTaskItem(TaskItem taskItem) { - TaskItems.Add(taskItem); - CurrentTaskItem = taskItem; + InvokeUI(() => + { + TaskItems.Add(taskItem); + CurrentTaskItem = taskItem; + }); } /// <summary> @@ -400,14 +414,20 @@ namespace Tango.MachineStudio.UI.Notifications /// <param name="taskItem">The task item.</param> public void PopTaskItem(TaskItem taskItem) { - TaskItems.Remove(taskItem); - - if (TaskItems.Count > 0) + Task.Delay(1000).ContinueWith((x) => { - CurrentTaskItem = TaskItems.Last(); - } + InvokeUI(() => + { + TaskItems.Remove(taskItem); - RaisePropertyChanged(nameof(HasTaskItems)); + if (TaskItems.Count > 0) + { + CurrentTaskItem = TaskItems.Last(); + } + + RaisePropertyChanged(nameof(HasTaskItems)); + }); + }); } /// <summary> |
