aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2017-12-19 10:25:40 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2017-12-19 10:25:40 +0200
commitafc7a07d285e08d905c58dd5978441c155b2f296 (patch)
treea2f4f51ef2747ae3a2aded2637a352ce8ef85934 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
parentad35c9c2df0001157ea13312382f3cdfdad67f06 (diff)
downloadTango-afc7a07d285e08d905c58dd5978441c155b2f296.tar.gz
Tango-afc7a07d285e08d905c58dd5978441c155b2f296.zip
MERGE.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.pngbin0 -> 3373 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs11
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs104
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml10
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs12
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml40
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml.cs83
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs53
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj18
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs50
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs57
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml32
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs35
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml105
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml15
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config1
20 files changed, 592 insertions, 63 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
index b3b92b6ab..ca553de1e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
@@ -14,13 +14,9 @@ namespace Tango.MachineStudio.UI
/// </summary>
public partial class App : Application
{
- public static ObservablesEntitiesAdapter DbAdapter { get; set; }
-
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
-
- DbAdapter = ObservablesEntitiesAdapter.Instance;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png
new file mode 100644
index 000000000..46f0d38fc
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs
index 3f7d4cad8..9193cfd3e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs
@@ -1,4 +1,5 @@
using MahApps.Metro.Controls;
+using Microsoft.Practices.ServiceLocation;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,6 +14,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.MachineStudio.Common.StudioApplication;
namespace Tango.MachineStudio.UI
{
@@ -26,8 +28,15 @@ namespace Tango.MachineStudio.UI
public MainWindow()
{
InitializeComponent();
-
Instance = this;
+
+ this.Closing += MainWindow_Closing;
+ }
+
+ private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ e.Cancel = true;
+ ServiceLocator.Current.GetInstance<IStudioApplicationManager>().ShutDown();
}
}
}
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 8e0fd2220..b1ba03109 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs
@@ -7,17 +7,49 @@ using System.Windows;
using MaterialDesignThemes.Wpf;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.UI.Windows;
+using System.Windows.Media;
+using Tango.Core;
+using System.Collections.ObjectModel;
namespace Tango.MachineStudio.UI.Notifications
{
- public class DefaultNotificationProvider : INotificationProvider
+ public class DefaultNotificationProvider : ExtendedObject, INotificationProvider
{
- public bool ShowDialog<T>(PackIconKind icon, string title, object context) where T : FrameworkElement
+ public ObservableCollection<TaskItem> TaskItems { get; private set; }
+
+ public bool HasTaskItems
{
- return ShowDialog(icon, title, Activator.CreateInstance<T>(), context);
+ get { return TaskItems.Count > 0; }
}
- public bool ShowDialog(PackIconKind icon, string title, FrameworkElement content, object context)
+ private TaskItem _currentTaskItem;
+
+ public TaskItem CurrentTaskItem
+ {
+ get { return _currentTaskItem; }
+ set { _currentTaskItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasTaskItems)); }
+ }
+
+ public DefaultNotificationProvider()
+ {
+ TaskItems = new ObservableCollection<TaskItem>();
+ }
+
+ public bool ShowModalWindow<T>(PackIconKind icon, string title, object context) where T : FrameworkElement
+ {
+ return ShowModalWindow(icon, title, Activator.CreateInstance<T>(), context);
+ }
+
+ public bool? ShowModalWindow(Window window)
+ {
+ window.Owner = Application.Current.MainWindow;
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible;
+ bool result = window.ShowDialog().Value;
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
+ return result;
+ }
+
+ public bool ShowModalWindow(PackIconKind icon, string title, FrameworkElement content, object context)
{
DialogWindow dialog = new DialogWindow(content);
dialog.DataContext = context;
@@ -28,5 +60,69 @@ namespace Tango.MachineStudio.UI.Notifications
MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
return result;
}
+
+ public bool? ShowDialog(PackIconKind icon, Brush iconColor, string message, bool hasCancel)
+ {
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible;
+
+ var result = new MessageBoxWindow()
+ {
+ Owner = Application.Current.MainWindow,
+ Message = message,
+ IconKind = icon,
+ IconColor = iconColor,
+ HasCancel = hasCancel
+
+ }.ShowDialog();
+
+ MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden;
+ return result;
+ }
+
+ public void ShowError(string message)
+ {
+ ShowDialog(PackIconKind.Exclamation, Brushes.Red, message, false);
+ }
+
+ public void ShowInfo(string message)
+ {
+ ShowDialog(PackIconKind.Information, Brushes.Black, message, false);
+ }
+
+ public bool ShowQuestion(string message)
+ {
+ return ShowDialog(PackIconKind.CommentQuestionOutline, Brushes.Black, message, true).Value;
+ }
+
+ public void ShowWarnning(string message)
+ {
+ ShowDialog(PackIconKind.Exclamation, Brushes.DarkOrange, message, false);
+ }
+
+ public void PushTaskItem(TaskItem taskItem)
+ {
+ TaskItems.Add(taskItem);
+ CurrentTaskItem = taskItem;
+ }
+
+ public TaskItem PushTaskItem(string message)
+ {
+ TaskItem item = new TaskItem(this);
+ item.Message = message;
+ PushTaskItem(item);
+ return item;
+ }
+
+ public void PopTaskItem(TaskItem taskItem)
+ {
+ TaskItems.Remove(taskItem);
+
+ if (TaskItems.Count > 0)
+ {
+ CurrentTaskItem = TaskItems.Last();
+ }
+
+ RaisePropertyChanged(nameof(HasTaskItems));
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml
index f23776ec2..2a8dd9f28 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml
@@ -12,17 +12,9 @@
<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}" />
+ <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" 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>
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
index c946d2b88..31dd3d644 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs
@@ -1,4 +1,5 @@
using MahApps.Metro.Controls;
+using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -38,6 +39,17 @@ namespace Tango.MachineStudio.UI.Windows
+ public PackIconKind IconKind
+ {
+ get { return (PackIconKind)GetValue(IconKindProperty); }
+ set { SetValue(IconKindProperty, value); }
+ }
+ public static readonly DependencyProperty IconKindProperty =
+ DependencyProperty.Register("IconKind", typeof(PackIconKind), typeof(DialogWindow), new PropertyMetadata(PackIconKind.Information));
+
+
+
+
public DialogWindow(FrameworkElement content) : this()
{
presenter.Content = content;
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml
new file mode 100644
index 000000000..4f3b826fe
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml
@@ -0,0 +1,40 @@
+<Window x:Class="Tango.MachineStudio.UI.Notifications.MessageBoxWindow"
+ 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:Tango.MachineStudio.UI.Notifications"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ mc:Ignorable="d"
+ Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent">
+
+ <Window.Resources>
+ <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter>
+ </Window.Resources>
+
+ <Grid>
+ <Border Background="White" CornerRadius="10" Padding="10" Margin="20">
+ <Border.Effect>
+ <DropShadowEffect ShadowDepth="0" BlurRadius="10"></DropShadowEffect>
+ </Border.Effect>
+ <DockPanel LastChildFill="True">
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Click="OnOKClicked">
+ ACCEPT
+ </Button>
+ <Button Visibility="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=HasCancel,Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Click="OnCancelClicked">
+ CANCEL
+ </Button>
+ </StackPanel>
+ <Grid>
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0 30 0 0">
+ <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Top" Width="50" Height="50" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconColor}" />
+ <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400"></TextBlock>
+ </StackPanel>
+ </Grid>
+ </DockPanel>
+ </Border>
+ </Grid>
+</Window>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml.cs
new file mode 100644
index 000000000..7ce4965ef
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml.cs
@@ -0,0 +1,83 @@
+using MahApps.Metro.Controls;
+using MaterialDesignThemes.Wpf;
+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.Animation;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Tango.MachineStudio.UI.Notifications
+{
+ /// <summary>
+ /// Interaction logic for MessageBoxWindow.xaml
+ /// </summary>
+ public partial class MessageBoxWindow : Window
+ {
+ public MessageBoxWindow()
+ {
+ InitializeComponent();
+ this.Loaded += MessageBoxWindow_Loaded;
+ }
+
+ private void MessageBoxWindow_Loaded(object sender, RoutedEventArgs e)
+ {
+ DoubleAnimation ani = new DoubleAnimation();
+ ani.To = 1;
+ ani.Duration = TimeSpan.FromSeconds(0.5);
+ this.BeginAnimation(Window.OpacityProperty, ani);
+ }
+
+ public String Message
+ {
+ get { return (String)GetValue(MessageProperty); }
+ set { SetValue(MessageProperty, value); }
+ }
+ public static readonly DependencyProperty MessageProperty =
+ DependencyProperty.Register("Message", typeof(String), typeof(MessageBoxWindow), new PropertyMetadata(null));
+
+ public Brush IconColor
+ {
+ get { return (Brush)GetValue(IconColorProperty); }
+ set { SetValue(IconColorProperty, value); }
+ }
+ public static readonly DependencyProperty IconColorProperty =
+ DependencyProperty.Register("IconColor", typeof(Brush), typeof(MessageBoxWindow), new PropertyMetadata(Brushes.Black));
+
+ public PackIconKind IconKind
+ {
+ get { return (PackIconKind)GetValue(IconKindProperty); }
+ set { SetValue(IconKindProperty, value); }
+ }
+ public static readonly DependencyProperty IconKindProperty =
+ DependencyProperty.Register("IconKind", typeof(PackIconKind), typeof(MessageBoxWindow), new PropertyMetadata(PackIconKind.Information));
+
+ public bool HasCancel
+ {
+ get { return (bool)GetValue(HasCancelProperty); }
+ set { SetValue(HasCancelProperty, value); }
+ }
+ public static readonly DependencyProperty HasCancelProperty =
+ DependencyProperty.Register("HasCancel", typeof(bool), typeof(MessageBoxWindow), new PropertyMetadata(false));
+
+ private void OnOKClicked(object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ Close();
+ }
+
+ private void OnCancelClicked(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ Close();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
new file mode 100644
index 000000000..b95a74a3e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
@@ -0,0 +1,53 @@
+using Microsoft.Practices.ServiceLocation;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Tango.Core.Helpers;
+using Tango.MachineStudio.Common.StudioApplication;
+using Tango.MachineStudio.Common.Navigation;
+using GalaSoft.MvvmLight.Ioc;
+using System.Reflection;
+using System.Collections;
+
+namespace Tango.MachineStudio.UI.StudioApplication
+{
+ public class DefaultStudioApplicationManager : IStudioApplicationManager
+ {
+ private INavigationManager _navigationManager;
+
+ public DefaultStudioApplicationManager(INavigationManager navigationManager)
+ {
+ _navigationManager = navigationManager;
+ }
+
+ public async void ShutDown()
+ {
+ _navigationManager.NavigateTo(NavigationView.ShutdownView);
+
+ await Task.Factory.StartNew(async () =>
+ {
+
+ //Do Shutdown Procedures...
+ foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase<IShutdownRequestBlocker>())
+ {
+ var result = await vm.OnShutdownRequest();
+ if (!result)
+ {
+ ThreadsHelper.InvokeUI(() =>
+ {
+ _navigationManager.NavigateTo(NavigationView.MainView);
+ });
+ return;
+ }
+ }
+
+ Thread.Sleep(3000);
+ Environment.Exit(0);
+
+ });
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
index 9d2860241..be0c1a829 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
@@ -70,6 +70,9 @@
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
+ <Reference Include="SimpleValidator, Version=0.6.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
@@ -96,10 +99,14 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="StudioApplication\DefaultStudioApplicationManager.cs" />
<Compile Include="Authentication\DefaultAuthenticationProvider.cs" />
<Compile Include="Modules\DefaultStudioModuleLoader.cs" />
<Compile Include="Navigation\DefaultNavigationManager.cs" />
<Compile Include="Notifications\DefaultNotificationProvider.cs" />
+ <Compile Include="Notifications\MessageBoxWindow.xaml.cs">
+ <DependentUpon>MessageBoxWindow.xaml</DependentUpon>
+ </Compile>
<Compile Include="SupervisingController\IMainView.cs" />
<Compile Include="ViewModels\LoadingViewVM.cs" />
<Compile Include="ViewModels\LoginViewVM.cs" />
@@ -136,6 +143,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
+ <Page Include="Notifications\MessageBoxWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -232,7 +243,12 @@
<ItemGroup>
<Resource Include="Images\machine-trans.png" />
</ItemGroup>
- <ItemGroup />
+ <ItemGroup>
+ <Resource Include="Images\account.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Controls\" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>$(TargetDir)linkgen.exe -s "$(TargetPath)" -d "$(TargetDir)Utilities\Machine Studio.lnk"</PostBuildEvent>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
index 5095dfc93..f4a7a7502 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
@@ -7,10 +7,12 @@ using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.Modules;
using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.UI.Authentication;
using Tango.MachineStudio.UI.Modules;
using Tango.MachineStudio.UI.Navigation;
using Tango.MachineStudio.UI.Notifications;
+using Tango.MachineStudio.UI.StudioApplication;
using Tango.MachineStudio.UI.SupervisingController;
using Tango.MachineStudio.UI.ViewModels;
using Tango.MachineStudio.UI.Views;
@@ -45,11 +47,13 @@ namespace Tango.MachineStudio.UI
SimpleIoc.Default.Unregister<IAuthenticationProvider>();
SimpleIoc.Default.Unregister<INavigationManager>();
SimpleIoc.Default.Unregister<IStudioModuleLoader>();
+ SimpleIoc.Default.Unregister<IStudioApplicationManager>();
SimpleIoc.Default.Register<INotificationProvider, DefaultNotificationProvider>();
SimpleIoc.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>();
SimpleIoc.Default.Register<INavigationManager, DefaultNavigationManager>();
SimpleIoc.Default.Register<IStudioModuleLoader, DefaultStudioModuleLoader>();
+ SimpleIoc.Default.Register<IStudioApplicationManager, DefaultStudioApplicationManager>();
SimpleIoc.Default.Register<MainViewVM>();
SimpleIoc.Default.Register<LoadingViewVM>();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
index 72ab5aca9..f50b734f4 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
@@ -4,26 +4,58 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using Tango.Core.Threading;
+using Tango.DAL.Observables;
using Tango.MachineStudio.Common.Modules;
using Tango.MachineStudio.Common.Navigation;
+using Tango.MachineStudio.Common.Notifications;
using Tango.SharedUI;
namespace Tango.MachineStudio.UI.ViewModels
{
public class LoadingViewVM : ViewModel
{
- public LoadingViewVM(INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader)
+ private INotificationProvider _notificationProvider;
+ private INavigationManager _navigationManager;
+ private IStudioModuleLoader _studioModuleLoader;
+
+ public LoadingViewVM(INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider)
+ {
+ _navigationManager = navigationManager;
+ _studioModuleLoader = studioModuleLoader;
+ _notificationProvider = notificationProvider;
+ Load();
+ }
+
+ private void Load()
{
- Task.Factory.StartNew(() =>
+ StaThreadHelper.StartStaThread(() =>
{
Thread.Sleep(3000);
- }).ContinueWith((x) =>
- {
-
- studioModuleLoader.LoadModules();
- navigationManager.NavigateTo(NavigationView.LoginView);
-
- }, TaskScheduler.FromCurrentSynchronizationContext());
+ try
+ {
+ ObservablesEntitiesAdapter.Instance.Initialize();
+ InvokeUI(() =>
+ {
+ _studioModuleLoader.LoadModules();
+ _navigationManager.NavigateTo(NavigationView.LoginView);
+ });
+ }
+ catch (Exception ex)
+ {
+ InvokeUINow(() =>
+ {
+ if (_notificationProvider.ShowQuestion("An error occurred while trying to connect to Twine database." + Environment.NewLine + "Would you like to try again?"))
+ {
+ Load();
+ }
+ else
+ {
+ Environment.Exit(0);
+ }
+ });
+ }
+ });
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
index 67c116790..6fe90fa99 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
@@ -1,13 +1,17 @@
using System;
+using System.Collections;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
using Tango.Core.Commands;
+using Tango.Core.Cryptography;
using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.Navigation;
+using Tango.MachineStudio.Common.Notifications;
+using Tango.Settings;
using Tango.SharedUI;
namespace Tango.MachineStudio.UI.ViewModels
@@ -16,34 +20,59 @@ namespace Tango.MachineStudio.UI.ViewModels
{
private IAuthenticationProvider _authenticationProvider;
private INavigationManager _navigationManager;
+ private INotificationProvider _notificationProvider;
+ private Rfc2898Cryptographer cryptographer;
private String _email;
+ [Required(ErrorMessage = "Email is required")]
+ [EmailAddress(ErrorMessage = "Please enter a valid email")]
public String Email
{
get { return _email; }
set { _email = value; RaisePropertyChangedAuto(); }
}
- public RelayCommand<PasswordBox> LoginCommand { get; set; }
+ private bool _rememberMe;
- public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager)
+ public bool RememberMe
{
+ get { return _rememberMe; }
+ set { _rememberMe = value; RaisePropertyChangedAuto(); }
+ }
+
+
+ public RelayCommand<String> LoginCommand { get; set; }
+
+ public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider)
+ {
+ _notificationProvider = notificationProvider;
_navigationManager = navigationManager;
_authenticationProvider = authenticationProvider;
- LoginCommand = new RelayCommand<PasswordBox>(Login);
+ LoginCommand = new RelayCommand<String>(Login);
+
+ cryptographer = new Rfc2898Cryptographer();
+ Email = SettingsManager.Default.MachineStudio.LastLoginEmail;
+ RememberMe = SettingsManager.Default.MachineStudio.RememberMe;
}
- private void Login(PasswordBox passwordBox)
+ private void Login(String password)
{
- String password = passwordBox.Password;
- try
- {
- _authenticationProvider.Login(Email, password);
- _navigationManager.NavigateTo(NavigationView.MainView);
- }
- catch (Exception ex)
+ if (Validate())
{
- MessageBox.Show("Failed");
+ try
+ {
+ _authenticationProvider.Login(Email, password);
+ _navigationManager.NavigateTo(NavigationView.MainView);
+ SettingsManager.Default.MachineStudio.LastLoginEmail = Email;
+ SettingsManager.Default.MachineStudio.RememberMe = RememberMe;
+
+ SettingsManager.Default.MachineStudio.LastLoginPassword = RememberMe ? cryptographer.Encrypt(password) : null;
+ SettingsManager.SaveDefaultSettings();
+ }
+ catch
+ {
+ _notificationProvider.ShowError("Invalid credentials. Please try again.");
+ }
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index 213d1a83d..7ef47fabd 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -10,6 +10,7 @@ using Tango.Core.Commands;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Authentication;
using Tango.MachineStudio.Common.Modules;
+using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.UI.SupervisingController;
using Tango.SharedUI;
@@ -52,10 +53,24 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _studioModuleLoader = value; RaisePropertyChangedAuto(); }
}
- public MainViewVM(IMainView view, IAuthenticationProvider authenticationProvider, IStudioModuleLoader studioModuleLoader) : base(view)
+ private INotificationProvider _notificationProvider;
+
+ public INotificationProvider NotificationProvider
+ {
+ get { return _notificationProvider; }
+ set { _notificationProvider = value; RaisePropertyChangedAuto(); }
+ }
+
+
+ public MainViewVM(
+ IMainView view,
+ IAuthenticationProvider authenticationProvider,
+ IStudioModuleLoader studioModuleLoader,
+ INotificationProvider notificationProvider) : base(view)
{
AuthenticationProvider = authenticationProvider;
StudioModuleLoader = studioModuleLoader;
+ NotificationProvider = notificationProvider;
StartModuleCommand = new RelayCommand<IStudioModule>(StartModule);
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml
index ab0875023..459c8fde8 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml
@@ -6,7 +6,7 @@
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
mc:Ignorable="d"
- d:DesignHeight="720" d:DesignWidth="1280" DataContext="{Binding LoadingViewVM, Source={StaticResource Locator}}" Background="White">
+ d:DesignHeight="720" d:DesignWidth="1280" Cursor="Wait" DataContext="{Binding LoadingViewVM, Source={StaticResource Locator}}" Background="White">
<Grid>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel>
@@ -15,7 +15,7 @@
<TextBlock FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock>
</StackPanel>
<TextBlock HorizontalAlignment="Right" FontSize="18" Margin="0 0 -50 0" Foreground="{StaticResource AccentColorBrush}">Twine Solutions</TextBlock>
- <mahapps:ProgressRing Margin="20 60 20 20" Width="80" Height="80"></mahapps:ProgressRing>
+ <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80"></mahapps:ProgressRing>
<TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic">Loading, please wait...</TextBlock>
</StackPanel>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml
index 60590a16b..1531370af 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml
@@ -2,17 +2,41 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:rules="clr-namespace:Tango.MachineStudio.Common.ValidationRules;assembly=Tango.MachineStudio.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280" DataContext="{Binding LoginViewVM, Source={StaticResource Locator}}" Background="White">
+
+ <UserControl.Resources>
+ <rules:Required x:Key="Required"></rules:Required>
+ </UserControl.Resources>
+
+
+ <UserControl.InputBindings>
+ <KeyBinding Key="Return" Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}"></KeyBinding>
+ </UserControl.InputBindings>
<Grid>
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300">
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40">
<Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image>
- <TextBox Margin="0 40 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged}" />
- <PasswordBox x:Name="txtPass" Margin="0 20 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" />
- <Button Margin="0 40 0 0" Height="50" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=txtPass}">LOGIN</Button>
+ <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock>
+ </StackPanel>
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Margin="0 120 0 0">
+ <TextBlock HorizontalAlignment="Center" FontSize="24">Login to your account</TextBlock>
+ <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" Width="100" Margin="0 20 0 0"></Image>
+ <DockPanel Margin="0 20 0 0">
+ <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtEmail, Path=BorderBrush}" Kind="EmailOutline" />
+ <TextBox x:Name="txtEmail" IsTabStop="True" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged,ValidatesOnNotifyDataErrors=True}" AutomationProperties.IsRequiredForForm="True" />
+ </DockPanel>
+ <DockPanel Margin="0 20 0 0">
+ <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtPass, Path=BorderBrush}" Kind="Key" />
+ <PasswordBox x:Name="txtPass" PasswordChanged="txtPass_PasswordChanged" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" />
+ </DockPanel>
+ <CheckBox Margin="25 20 0 0" IsChecked="{Binding RememberMe}">Remember me</CheckBox>
+ <Button Margin="25 20 0 0" Height="50" Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Content="LOGIN">
+
+ </Button>
</StackPanel>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs
index 0b3a9ae4f..027e37682 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs
@@ -12,17 +12,50 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using static Tango.SharedUI.Controls.MultiTransitionControl;
+using SimpleValidator.Extensions;
+using Tango.Settings;
+using Tango.Core.Cryptography;
namespace Tango.MachineStudio.UI.Views
{
/// <summary>
/// Interaction logic for LoginView.xaml
/// </summary>
- public partial class LoginView : UserControl
+ public partial class LoginView : UserControl, ITransitionView
{
+ private Rfc2898Cryptographer cryptographer;
+
public LoginView()
{
InitializeComponent();
+
+ cryptographer = new Rfc2898Cryptographer();
+ }
+
+ public String Password
+ {
+ get { return (String)GetValue(PasswordProperty); }
+ set { SetValue(PasswordProperty, value); }
+ }
+ public static readonly DependencyProperty PasswordProperty =
+ DependencyProperty.Register("Password", typeof(String), typeof(LoginView), new PropertyMetadata(null));
+
+ public void OnTransitionCompleted()
+ {
+ txtEmail.Focus();
+
+ if (txtEmail.Text.IsNotNullOrWhiteSpace())
+ {
+ txtPass.Focus();
+ }
+
+ txtPass.Password = cryptographer.Decrypt(SettingsManager.Default.MachineStudio.LastLoginPassword);
+ }
+
+ private void txtPass_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ Password = txtPass.Password;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
index 98b6ecb73..cb7378666 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
@@ -3,36 +3,78 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:dockablz="clr-namespace:Dragablz.Dockablz;assembly=Dragablz"
xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views;assembly=Tango.MachineStudio.DB"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1270" Background="White" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}">
<Grid>
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="True">
+ <Setter Property="Cursor" Value="AppStarting"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="False">
+ <Setter Property="Cursor" Value="Arrow"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
+
<materialDesign:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
<materialDesign:DrawerHost.LeftDrawerContent>
- <DockPanel MinWidth="212">
- <Grid DockPanel.Dock="Top">
+ <StackPanel MinWidth="300">
+ <Grid>
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
HorizontalAlignment="Right" Margin="16"
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
<StackPanel Margin="5 0 0 0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
- <materialDesign:PackIcon VerticalAlignment="Center" Kind="Account" Foreground="{StaticResource AccentColorBrush}" Width="32" Height="32"></materialDesign:PackIcon>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center">User Name</TextBlock>
+ <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image>
+ <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock>
</StackPanel>
</Grid>
- <ListBox x:Name="DemoItemsListBox" Margin="0 16 0 16" SelectedIndex="0">
- <Button Command="{Binding HomeCommand}" Style="{DynamicResource MaterialDesignFlatButton}">Home</Button>
- <ListBoxItem>Item 2</ListBoxItem>
- <ListBoxItem>Item 3</ListBoxItem>
- <ListBoxItem>Item 4</ListBoxItem>
- <ListBoxItem>Item 5</ListBoxItem>
+ <StackPanel Margin="0 16 0 0">
+ <ListBoxItem>
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="PreviewMouseUp">
+ <i:InvokeCommandAction Command="{Binding HomeCommand}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon VerticalAlignment="Center" Kind="Home" Width="32" Height="32"></materialDesign:PackIcon>
+ <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Home</TextBlock>
+ </StackPanel>
+ </ListBoxItem>
+ </StackPanel>
+ <ListBox ItemsSource="{Binding StudioModuleLoader.UserModules}" HorizontalContentAlignment="Stretch">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
+ <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter>
+ </Style>
+ </ListBox.ItemContainerStyle>
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid Background="Transparent">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="PreviewMouseUp">
+ <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+
+ <TextBlock Text="{Binding Name}" ToolTip="{Binding Description}"></TextBlock>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
</ListBox>
- </DockPanel>
+ </StackPanel>
</materialDesign:DrawerHost.LeftDrawerContent>
<DockPanel>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2"
@@ -150,6 +192,47 @@
<ContentPresenter Content="{Binding CurrentModule.MainView}"></ContentPresenter>
</Grid>
</Grid>
+
+ <Border HorizontalAlignment="Right" Margin="0 -1 10 0" VerticalAlignment="Top" Width="300" Height="40" Padding="5" CornerRadius="0 0 30 30" BorderThickness="1 0 1 1" BorderBrush="DimGray">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="RenderTransform">
+ <Setter.Value>
+ <ScaleTransform ScaleX="1" ScaleY="0"></ScaleTransform>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="True">
+ <DataTrigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2"></DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.EnterActions>
+ <DataTrigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation BeginTime="00:00:01" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.ExitActions>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Border.Background>
+ <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
+ <GradientStop Color="#03A9F4"/>
+ <GradientStop Color="#0081BB" Offset="1"/>
+ </LinearGradientBrush>
+ </Border.Background>
+
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20 0 0 0">
+ <mahapps:ProgressRing Width="24" Height="24" Foreground="White"></mahapps:ProgressRing>
+ <TextBlock Text="{Binding NotificationProvider.CurrentTaskItem.Message}" Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0"></TextBlock>
+ </StackPanel>
+ </Border>
</Grid>
</DockPanel>
</materialDesign:DrawerHost>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml
index 20329ef25..487dfe1f8 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml
@@ -3,10 +3,21 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300" DataContext="{Binding ShutdownViewVM, Source={StaticResource Locator}}">
+ d:DesignHeight="720" d:DesignWidth="1280" Cursor="Wait" Background="White" DataContext="{Binding ShutdownViewVM, Source={StaticResource Locator}}">
<Grid>
-
+ <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
+ <StackPanel>
+ <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image>
+ <StackPanel Orientation="Horizontal">
+ <TextBlock FontSize="70" Foreground="Gray">Machine Studio</TextBlock>
+ </StackPanel>
+ <TextBlock HorizontalAlignment="Right" FontSize="18" Margin="0 0 -50 0" Foreground="Gray">Twine Solutions</TextBlock>
+ <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80" Foreground="Gray"></mahapps:ProgressRing>
+ <TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic" Foreground="Gray">Shutting Down, please wait...</TextBlock>
+ </StackPanel>
+ </Grid>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config
index 2da000205..3a7265a72 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config
@@ -9,4 +9,5 @@
<package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" />
<package id="MvvmLight" version="5.3.0.0" targetFramework="net46" />
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" />
+ <package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" />
</packages> \ No newline at end of file