From 27fe2f3f63191ecefbb00f16acf2b8b089a30d83 Mon Sep 17 00:00:00 2001 From: Roy Date: Fri, 15 Dec 2017 03:34:09 +0200 Subject: Added Login. Implemented message boxes through notification provider. Implemented VM auto validation using data annotation. --- .../Controls/MdiContainerControl.xaml | 2 +- .../Notifications/INotificationProvider.cs | 17 +++++++++++++++-- .../Tango.MachineStudio.Common.csproj | 1 + .../ValidationRules/Required.cs | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml index 3896347fe..b248a4aec 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls" xmlns:converters="clr-namespace:Tango.MachineStudio.Common.Converters" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Background="White"> + d:DesignHeight="300" d:DesignWidth="300"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs index e14df21ba..9e13713d0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs @@ -5,13 +5,26 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Windows.Media; namespace Tango.MachineStudio.Common.Notifications { public interface INotificationProvider { - bool ShowDialog(PackIconKind icon, String title, object context) where T : FrameworkElement; + bool? ShowModalWindow(Window window); - bool ShowDialog(PackIconKind icon, String title, FrameworkElement content, object context); + bool ShowModalWindow(PackIconKind icon, String title, object context) where T : FrameworkElement; + + bool ShowModalWindow(PackIconKind icon, String title, FrameworkElement content, object context); + + bool? ShowDialog(PackIconKind icon, Brush iconColor, String message, bool hasCancel); + + void ShowInfo(String message); + + void ShowWarnning(String message); + + void ShowError(String message); + + bool ShowQuestion(String message); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index c94e6fbdc..23d0f7b76 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -53,6 +53,7 @@ + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs new file mode 100644 index 000000000..84f274965 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; + +namespace Tango.MachineStudio.Common.ValidationRules +{ + public class Required : ValidationRule + { + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + return new ValidationResult(!String.IsNullOrWhiteSpace(value.ToStringSafe()), "Required"); + } + } +} -- cgit v1.3.1