aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs50
2 files changed, 51 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
index b3c4f5cb3..bc57aee20 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
@@ -8,6 +8,7 @@ using Tango.Core;
using Tango.BL.Entities;
using Tango.MachineStudio.Common.Authentication;
using Tango.BL;
+using Tango.BL.Enumerations;
namespace Tango.MachineStudio.UI.Authentication
{
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>