From 84c6b6dc548751769db3d489effe2f5f5df2d08d Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 23 Feb 2020 14:50:11 +0200 Subject: Snapback improvements. --- .../FSE/Tango.FSE.Common/Notifications/SnackbarItem.cs | 17 ++++++++++++----- .../Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml | 5 +++++ 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'Software') diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/SnackbarItem.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/SnackbarItem.cs index 06f28f89c..652d3067b 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/SnackbarItem.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/SnackbarItem.cs @@ -13,6 +13,7 @@ namespace Tango.FSE.Common.Notifications { private Action _closeAction; private Action _pressAction; + private bool _isClosed; public MessageType Type { get; set; } @@ -69,19 +70,25 @@ namespace Tango.FSE.Common.Notifications { Task.Delay(Timeout.Value).ContinueWith((x) => { - Close(); + if (!_isClosed) + { + IsClosing = true; + Task.Delay(TimeSpan.FromSeconds(2)).ContinueWith((y) => + { + Close(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } }, TaskScheduler.FromCurrentSynchronizationContext()); } } public void Close() { - IsClosing = true; - - Task.Delay(TimeSpan.FromSeconds(2)).ContinueWith((x) => + if (!_isClosed) { + _isClosed = true; TangoIOC.Default.GetInstance().PopSnackbarItem(this); - }, TaskScheduler.FromCurrentSynchronizationContext()); + } } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml index 90985c969..26d6a7843 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml @@ -49,6 +49,11 @@ + + + + + -- cgit v1.3.1