aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs32
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml32
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs58
3 files changed, 122 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
new file mode 100644
index 000000000..8e0fd2220
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using MaterialDesignThemes.Wpf;
+using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.UI.Windows;
+
+namespace Tango.MachineStudio.UI.Notifications
+{
+ public class DefaultNotificationProvider : INotificationProvider
+ {
+ public bool ShowDialog<T>(PackIconKind icon, string title, object context) where T : FrameworkElement
+ {
+ return ShowDialog(icon, title, Activator.CreateInstance<T>(), context);
+ }
+
+ public bool ShowDialog(PackIconKind icon, string title, FrameworkElement content, object context)
+ {
+ DialogWindow dialog = new DialogWindow(content);
+ dialog.DataContext = context;
+ dialog.InnerTitle = title;
+ dialog.Owner = Application.Current.MainWindow;
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible;
+ bool result = dialog.ShowDialog().Value;
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
+ return result;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml
new file mode 100644
index 000000000..f23776ec2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml
@@ -0,0 +1,32 @@
+<mahapps:MetroWindow x:Class="Tango.MachineStudio.UI.Windows.DialogWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows"
+ mc:Ignorable="d"
+ Title="Machine Studio" Height="450" Width="650" EnableDWMDropShadow="True" ShowCloseButton="False" WindowTransitionsEnabled="False" ShowMaxRestoreButton="False" ShowMinButton="False" TitleCaps="False" BorderThickness="1" WindowStartupLocation="CenterOwner">
+ <Grid>
+ <Border Margin="16">
+ <DockPanel LastChildFill="True">
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" VerticalAlignment="Top">
+ <materialDesign:PackIcon Kind="TableEdit" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" />
+ <TextBlock Margin="10 0 0 0" Foreground="{StaticResource AccentColorBrush}" FontSize="16" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=InnerTitle}"></TextBlock>
+ </StackPanel>
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{Binding DialogOKCommand}" Click="OnOKClicked">
+ ACCEPT
+ </Button>
+ <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{Binding DialogCancelCommand}" Click="OnCancelClicked">
+ CANCEL
+ </Button>
+ </StackPanel>
+ <ScrollViewer Margin="0 10 0 10" VerticalScrollBarVisibility="Auto" Padding="5">
+ <ContentPresenter x:Name="presenter"></ContentPresenter>
+ </ScrollViewer>
+ </DockPanel>
+ </Border>
+ </Grid>
+</mahapps:MetroWindow>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs
new file mode 100644
index 000000000..c946d2b88
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs
@@ -0,0 +1,58 @@
+using MahApps.Metro.Controls;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Tango.Core.Commands;
+
+namespace Tango.MachineStudio.UI.Windows
+{
+ /// <summary>
+ /// Interaction logic for DialogWindow.xaml
+ /// </summary>
+ public partial class DialogWindow : MetroWindow
+ {
+ public DialogWindow()
+ {
+ InitializeComponent();
+ }
+
+
+
+ public String InnerTitle
+ {
+ get { return (String)GetValue(InnerTitleProperty); }
+ set { SetValue(InnerTitleProperty, value); }
+ }
+ public static readonly DependencyProperty InnerTitleProperty =
+ DependencyProperty.Register("InnerTitle", typeof(String), typeof(DialogWindow), new PropertyMetadata(null));
+
+
+
+ public DialogWindow(FrameworkElement content) : this()
+ {
+ presenter.Content = content;
+ }
+
+ private void OnOKClicked(object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ Close();
+ }
+
+ private void OnCancelClicked(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ Close();
+ }
+ }
+}