aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-04 15:28:15 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-04 15:28:15 +0200
commit2b8e41b5279c2d3ab370595f6593b64ea734ef87 (patch)
tree084ceaae9e1b65454e9e2264ce6fdb0511ca4cf9 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications
parentd734bb5cf08ba2433b74fc86a8858d2437d1a237 (diff)
downloadTango-2b8e41b5279c2d3ab370595f6593b64ea734ef87.tar.gz
Tango-2b8e41b5279c2d3ab370595f6593b64ea734ef87.zip
Implemented job embroidery image capture, display export,
Implemented running job text to speech.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs50
1 files changed, 50 insertions, 0 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 a07c0ef13..1c9b8732f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
@@ -193,6 +193,56 @@ namespace Tango.MachineStudio.UI.Notifications
}
/// <summary>
+ /// Shows the specified view with the specified view model as it's data context.
+ /// </summary>
+ /// <typeparam name="VM">The type of the mm.</typeparam>
+ /// <typeparam name="View">The type of the view.</typeparam>
+ /// <param name="vm">The view model.</param>
+ /// <param name="view">The view.</param>
+ /// <param name="onAccept">The accept action.</param>
+ /// <param name="onCancel">The cancel action.</param>
+ public void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM
+ {
+ DialogWindow dialog = new DialogWindow();
+ dialog.Owner = Application.Current.MainWindow;
+ dialog.InnerContent = view;
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible;
+ view.Loaded += (x, y) =>
+ {
+ VM context = vm;
+ dialog.DataContext = context;
+
+ Action onAcceptAction = null;
+ onAcceptAction = new Action(() =>
+ {
+ dialog.Close();
+ onAccept(context);
+ context.Accepted -= onAcceptAction;
+ });
+
+ Action onCancelAction = null;
+ onCancelAction = new Action(() =>
+ {
+ dialog.Close();
+
+ if (onCancel != null)
+ {
+ onCancel();
+ }
+
+ context.Canceled -= onCancelAction;
+ });
+
+ context.Accepted += onAcceptAction;
+ context.Canceled += onCancelAction;
+
+ context.OnShow();
+ };
+ dialog.ShowDialog();
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
+ }
+
+ /// <summary>
/// Creates a new view by a naming convention of the specified view model type.
/// </summary>
/// <typeparam name="VM">The type of the view model.</typeparam>