diff options
| author | Avi Levkovich <avi@twine-s.com> | 2017-12-19 12:28:20 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2017-12-19 12:28:20 +0200 |
| commit | 76aa983631df4fa5b16b170e2f6dd845c5ac9531 (patch) | |
| tree | 6b2b4d0776c54536ec07aabc6be94857dcee91fc /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 6bf71c81050b824398dc82ce4b69cdf71fb4a2f7 (diff) | |
| parent | b421701fd5cf000a16cab9b1fe9eda812ccce8c3 (diff) | |
| download | Tango-76aa983631df4fa5b16b170e2f6dd845c5ac9531.tar.gz Tango-76aa983631df4fa5b16b170e2f6dd845c5ac9531.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
40 files changed, 2084 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config new file mode 100644 index 000000000..250f57a4d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /> + </startup> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml new file mode 100644 index 000000000..6974f54be --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml @@ -0,0 +1,83 @@ +<Application x:Class="Tango.MachineStudio.UI.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.MachineStudio.UI" + xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz" + StartupUri="MainWindow.xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! --> + <!-- Accent and AppTheme setting --> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml"> + </ResourceDictionary> + <!--Material Design--> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/materialdesigncolor.lightblue.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/materialdesigncolor.yellow.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.CheckBox.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ListBox.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.RadioButton.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.TextBlock.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Label.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Slider.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.ProgressBar.xaml"/> + + + <!--MahApps Brushes--> + <ResourceDictionary> + <SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource Primary700}" /> + <SolidColorBrush x:Key="AccentColorBrush" Color="{DynamicResource Primary500}" /> + <SolidColorBrush x:Key="AccentColorBrush2" Color="{DynamicResource Primary400}" /> + <SolidColorBrush x:Key="AccentColorBrush3" Color="{DynamicResource Primary300}" /> + <SolidColorBrush x:Key="AccentColorBrush4" Color="{DynamicResource Primary200}" /> + <SolidColorBrush x:Key="WindowTitleColorBrush" Color="{DynamicResource Primary700}" /> + <SolidColorBrush x:Key="AccentSelectedColorBrush" Color="{DynamicResource Primary500Foreground}" /> + <LinearGradientBrush x:Key="ProgressBrush" EndPoint="0.001,0.5" StartPoint="1.002,0.5"> + <GradientStop Color="{DynamicResource Primary700}" Offset="0" /> + <GradientStop Color="{DynamicResource Primary300}" Offset="1" /> + </LinearGradientBrush> + <SolidColorBrush x:Key="CheckmarkFill" Color="{DynamicResource Primary500}" /> + <SolidColorBrush x:Key="RightArrowFill" Color="{DynamicResource Primary500}" /> + <SolidColorBrush x:Key="IdealForegroundColorBrush" Color="{DynamicResource Primary500Foreground}" /> + <SolidColorBrush x:Key="IdealForegroundDisabledBrush" Color="{DynamicResource Primary500}" Opacity="0.4" /> + </ResourceDictionary> + + <!-- Include the Dragablz Material Design style --> + <ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/materialdesign.xaml"/> + + <ResourceDictionary> + <!-- tell Dragablz tab control to use the Material Design theme --> + <Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource MaterialDesignTabablzControlStyle}" /> + </ResourceDictionary> + + <ResourceDictionary> + <local:ViewModelLocator x:Key="Locator" d:IsDataSource="True" /> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs new file mode 100644 index 000000000..ca553de1e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Tango.DAL.Observables; + +namespace Tango.MachineStudio.UI +{ + /// <summary> + /// Interaction logic for App.xaml + /// </summary> + public partial class App : Application + { + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs new file mode 100644 index 000000000..a30cf0f92 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Authentication; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Authentication; + +namespace Tango.MachineStudio.UI.Authentication +{ + public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider + { + private User _currentUser; + + public User CurrentUser + { + get { return _currentUser; } + set + { + _currentUser = value; + CurrentUserChanged?.Invoke(this, _currentUser); + RaisePropertyChangedAuto(); + } + } + + public event EventHandler<User> CurrentUserChanged; + + public User Login(string email, string password) + { + User user = ObservablesEntitiesAdapter.Instance.Users.SingleOrDefault(x => x.Email.ToLower() == email.ToLower() && x.Password == password); + + if (user == null) + { + throw new AuthenticationException("Login failed for user " + email); + } + + CurrentUser = user; + return user; + } + + public void Logout() + { + CurrentUser = null; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png Binary files differnew file mode 100644 index 000000000..46f0d38fc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/design.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/design.png Binary files differnew file mode 100644 index 000000000..5b1d473d8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/design.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machine-trans.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machine-trans.png Binary files differnew file mode 100644 index 000000000..a7cf65852 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machine-trans.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml new file mode 100644 index 000000000..963b9eb8b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -0,0 +1,34 @@ +<mahapps:MetroWindow x:Class="Tango.MachineStudio.UI.MainWindow" + 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.MachineStudio.UI" + xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views" + xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + mc:Ignorable="d" + Title="Tango" Height="720" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized"> + <Grid> + <sharedControls:MultiTransitionControl AlwaysFade="True" TransitionType="Zoom" x:Name="TransitionControl" x:FieldModifier="public"> + <sharedControls:MultiTransitionControl.Controls> + <ContentControl Tag="LoadingView"> + <views:LoadingView></views:LoadingView> + </ContentControl> + <ContentControl Tag="LoginView"> + <views:LoginView></views:LoginView> + </ContentControl> + <ContentControl Tag="MainView"> + <views:MainView></views:MainView> + </ContentControl> + <ContentControl Tag="ShutdownView"> + <views:ShutdownView></views:ShutdownView> + </ContentControl> + </sharedControls:MultiTransitionControl.Controls> + </sharedControls:MultiTransitionControl> + + <Grid Background="Black" Opacity="0.7" x:Name="shadowGrid" Visibility="Hidden"> + + </Grid> + </Grid> +</mahapps:MetroWindow> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs new file mode 100644 index 000000000..9193cfd3e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -0,0 +1,42 @@ +using MahApps.Metro.Controls; +using Microsoft.Practices.ServiceLocation; +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.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.Common.StudioApplication; + +namespace Tango.MachineStudio.UI +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : MetroWindow + { + public static MainWindow Instance { get; set; } + + 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/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs new file mode 100644 index 000000000..689ac7b38 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Authentication; +using Tango.MachineStudio.Common.Modules; + +namespace Tango.MachineStudio.UI.Modules +{ + public class DefaultStudioModuleLoader : ExtendedObject, IStudioModuleLoader + { + private IAuthenticationProvider _authenticationProvider; + private bool _loaded; + + public DefaultStudioModuleLoader(IAuthenticationProvider authenticationProvider) + { + _authenticationProvider = authenticationProvider; + AllModules = new ObservableCollection<IStudioModule>(); + UserModules = new ObservableCollection<IStudioModule>(); + _authenticationProvider.CurrentUserChanged += _authenticationProvider_CurrentUserChanged; + } + + private void _authenticationProvider_CurrentUserChanged(object sender, DAL.Observables.User e) + { + LoadModules(); + } + + private ObservableCollection<IStudioModule> _allModules; + public ObservableCollection<IStudioModule> AllModules + { + get { return _allModules; } + private set { _allModules = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<IStudioModule> _userModules; + public ObservableCollection<IStudioModule> UserModules + { + get { return _userModules; } + private set { _userModules = value; RaisePropertyChangedAuto(); } + } + + public void LoadModules() + { + if (!_loaded) + { + AllModules.Clear(); + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + foreach (var file in Directory.GetFiles(assemblyFolder, "*.dll").Where(x => x.Contains("MachineStudio"))) + { + try + { + Assembly moduleAssembly = null; + moduleAssembly = Assembly.LoadFrom(file); + + if (moduleAssembly != null) + { + foreach (var moduleType in moduleAssembly.GetTypes().Where(x => !x.IsInterface && typeof(IStudioModule).IsAssignableFrom(x))) + { + var module = Activator.CreateInstance(moduleType) as IStudioModule; + AllModules.Add(module); + } + } + } + catch { } + } + + _loaded = true; + } + + UserModules.Clear(); + + if (_authenticationProvider.CurrentUser != null) + { + UserModules = AllModules.Where(x => _authenticationProvider.CurrentUser.HasPermission(x.Permission)).ToObservableCollection(); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs new file mode 100644 index 000000000..10314ae62 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Navigation; + +namespace Tango.MachineStudio.UI.Navigation +{ + public class DefaultNavigationManager : INavigationManager + { + public void NavigateTo(NavigationView view) + { + MainWindow.Instance.TransitionControl.AutoNavigate(view.ToString()); + } + } +} 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..b1ba03109 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -0,0 +1,128 @@ +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; +using System.Windows.Media; +using Tango.Core; +using System.Collections.ObjectModel; + +namespace Tango.MachineStudio.UI.Notifications +{ + public class DefaultNotificationProvider : ExtendedObject, INotificationProvider + { + public ObservableCollection<TaskItem> TaskItems { get; private set; } + + public bool HasTaskItems + { + get { return TaskItems.Count > 0; } + } + + 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; + 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; + } + + 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 new file mode 100644 index 000000000..2a8dd9f28 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml @@ -0,0 +1,24 @@ +<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="{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> + <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..31dd3d644 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs @@ -0,0 +1,70 @@ +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.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 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; + } + + 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/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/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..5cdfd162a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] +[assembly: AssemblyTitle("Tango - Machine Studio")] +[assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs new file mode 100644 index 000000000..c035ee88d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.UI.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.UI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.Designer.cs new file mode 100644 index 000000000..dfd4da16f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.UI.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file 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/SupervisingController/IMainView.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs new file mode 100644 index 000000000..70b57027e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.SupervisingController +{ + public interface IMainView : IView + { + + } +} 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 new file mode 100644 index 000000000..be0c1a829 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -0,0 +1,256 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{116DFDB0-7681-46FE-8BAD-FE8AE09BB076}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>Tango.MachineStudio.UI</RootNamespace> + <AssemblyName>Tango.MachineStudio.UI</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\Build\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup> + <ApplicationIcon>design.ico</ApplicationIcon> + </PropertyGroup> + <ItemGroup> + <Reference Include="Dragablz, Version=0.0.3.197, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Dragablz.0.0.3.197\lib\net45\Dragablz.dll</HintPath> + </Reference> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> + </Reference> + <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> + </Reference> + <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" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <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" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\ShutdownViewVM.cs" /> + <Compile Include="Views\LoadingView.xaml.cs"> + <DependentUpon>LoadingView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\LoginView.xaml.cs"> + <DependentUpon>LoginView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Notifications\DialogWindow.xaml.cs"> + <DependentUpon>DialogWindow.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ShutdownView.xaml.cs"> + <DependentUpon>ShutdownView.xaml</DependentUpon> + </Compile> + <Page Include="MainWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Compile Include="MainWindow.xaml.cs"> + <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> + </Page> + <Page Include="Views\LoadingView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\LoginView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Notifications\DialogWindow.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\ShutdownView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType> + </SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <Resource Include="design.ico" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.DAL.Observables\Tango.DAL.Observables.csproj"> + <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project> + <Name>Tango.DAL.Observables</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.DAL.Remote\Tango.DAL.Remote.csproj"> + <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> + <Name>Tango.DAL.Remote</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\Modules\Tango.MachineStudio.DB\Tango.MachineStudio.DB.csproj"> + <Project>{94f7acf8-55e1-4a02-b9bc-a818413fdbbf}</Project> + <Name>Tango.MachineStudio.DB</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> + <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> + <Name>Tango.MachineStudio.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\design.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\machine-trans.png" /> + </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> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Themes/Generic.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Themes/Generic.xaml new file mode 100644 index 000000000..e3efa0c6a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Themes/Generic.xaml @@ -0,0 +1,9 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.MachineStudio.UI" + xmlns:controls="clr-namespace:Tango.MachineStudio.UI.Controls"> + +</ResourceDictionary> + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs new file mode 100644 index 000000000..f4a7a7502 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -0,0 +1,103 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Ioc; +using Microsoft.Practices.ServiceLocation; +using System; +using Tango.Logging; +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; + +namespace Tango.MachineStudio.UI +{ + /// <summary> + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// </summary> + public class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + public ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + ////if (ViewModelBase.IsInDesignModeStatic) + ////{ + //// // Create design time view services and models + //// SimpleIoc.Default.Register<IDataService, DesignDataService>(); + ////} + ////else + ////{ + //// // Create run time view services and models + //// SimpleIoc.Default.Register<IDataService, DataService>(); + ////} + + SimpleIoc.Default.Unregister<INotificationProvider>(); + 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>(); + SimpleIoc.Default.Register<ShutdownViewVM>(); + SimpleIoc.Default.Register<LoginViewVM>(); + + //Register View (Supervising Controller Pattern). + if (!ViewModelBase.IsInDesignModeStatic) + { + LogManager.Log(String.Format("Registering Supervising Controller {0}...", nameof(IMainView))); + SimpleIoc.Default.Register(() => (IMainView)MainView.Self); + } + } + + public MainViewVM MainViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MainViewVM>(); + } + } + + public LoadingViewVM LoadingViewVM + { + get + { + return ServiceLocator.Current.GetInstance<LoadingViewVM>(); + } + } + + public ShutdownViewVM ShutdownViewVM + { + get + { + return ServiceLocator.Current.GetInstance<ShutdownViewVM>(); + } + } + + public LoginViewVM LoginViewVM + { + get + { + return ServiceLocator.Current.GetInstance<LoginViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs new file mode 100644 index 000000000..f50b734f4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +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 + { + 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() + { + StaThreadHelper.StartStaThread(() => + { + Thread.Sleep(3000); + 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 new file mode 100644 index 000000000..6fe90fa99 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -0,0 +1,79 @@ +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 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 +{ + public class LoginViewVM : ViewModel + { + 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(); } + } + + private bool _rememberMe; + + 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<String>(Login); + + cryptographer = new Rfc2898Cryptographer(); + Email = SettingsManager.Default.MachineStudio.LastLoginEmail; + RememberMe = SettingsManager.Default.MachineStudio.RememberMe; + } + + private void Login(String password) + { + if (Validate()) + { + 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 new file mode 100644 index 000000000..7ef47fabd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +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; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class MainViewVM : ViewModel<IMainView> + { + private IStudioModule _currentModule; + + public IStudioModule CurrentModule + { + get { return _currentModule; } + set { _currentModule = value; RaisePropertyChangedAuto(); } + } + + private bool _isMenuOpened; + + public bool IsMenuOpened + { + get { return _isMenuOpened; } + set { _isMenuOpened = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand<IStudioModule> StartModuleCommand { get; set; } + + public RelayCommand HomeCommand { get; set; } + + private IAuthenticationProvider _authenticationProvider; + public IAuthenticationProvider AuthenticationProvider + { + get { return _authenticationProvider; } + set { _authenticationProvider = value; RaisePropertyChangedAuto(); } + } + + private IStudioModuleLoader _studioModuleLoader; + + public IStudioModuleLoader StudioModuleLoader + { + get { return _studioModuleLoader; } + set { _studioModuleLoader = value; RaisePropertyChangedAuto(); } + } + + 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); + + HomeCommand = new RelayCommand(Home); + } + + private void Home() + { + StartModule(null); + } + + private void StartModule(IStudioModule module) + { + IsMenuOpened = false; + CurrentModule = module; + } + + protected override void OnViewAttached() + { + base.OnViewAttached(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ShutdownViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ShutdownViewVM.cs new file mode 100644 index 000000000..c7a919a82 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ShutdownViewVM.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class ShutdownViewVM + { + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml new file mode 100644 index 000000000..459c8fde8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.LoadingView" + 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: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="720" d:DesignWidth="1280" Cursor="Wait" DataContext="{Binding LoadingViewVM, Source={StaticResource Locator}}" Background="White"> + <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="{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 40" Width="80" Height="80"></mahapps:ProgressRing> + <TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic">Loading, please wait...</TextBlock> + </StackPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml.cs new file mode 100644 index 000000000..15eba3cf8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Views +{ + /// <summary> + /// Interaction logic for LoadingView.xaml + /// </summary> + public partial class LoadingView : UserControl + { + public LoadingView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml new file mode 100644 index 000000000..1531370af --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml @@ -0,0 +1,42 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.LoginView" + 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 Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40"> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> + <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 new file mode 100644 index 000000000..027e37682 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs @@ -0,0 +1,61 @@ +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.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, 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 new file mode 100644 index 000000000..cb7378666 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -0,0 +1,240 @@ +<controls:View x:Class="Tango.MachineStudio.UI.Views.MainView" + 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: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> + <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"> + <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> + <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> + </StackPanel> + </materialDesign:DrawerHost.LeftDrawerContent> + <DockPanel> + <materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" + Mode="PrimaryMid" DockPanel.Dock="Top"> + <DockPanel> + <ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="{Binding IsMenuOpened}" + x:Name="MenuToggleButton"/> + <materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False"> + <StackPanel> + <Button Content="Home"/> + <Button Content="Nice Popup"/> + <Button Content="Can't Touch This" IsEnabled="False" /> + <Separator/> + <Button Content="Goodbye"/> + </StackPanel> + </materialDesign:PopupBox> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Text="Machine Studio" VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36"/> + </StackPanel> + </DockPanel> + </materialDesign:ColorZone> + + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid Grid.Row="1"> + <Grid.RowDefinitions> + <RowDefinition Height="150"/> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <Grid> + <StackPanel Margin="30 20" HorizontalAlignment="Left"> + <TextBlock Style="{StaticResource MaterialDesignDisplay1TextBlock}">Welcome to Machine Studio</TextBlock> + <TextBlock HorizontalAlignment="Right" Margin="0 5 -130 0" FontStyle="Italic" Style="{StaticResource MaterialDesignSubheadingTextBlock}" Foreground="{StaticResource AccentColorBrush}">Select Your Studio Module...</TextBlock> + </StackPanel> + </Grid> + <ItemsControl ItemsSource="{Binding StudioModuleLoader.UserModules}" Grid.Row="2" Margin="10"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True"></WrapPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + + <ItemsControl.ItemTemplate> + <DataTemplate> + <materialDesign:Card Width="300" Margin="10" Height="400"> + <Grid > + <Grid.RowDefinitions> + <RowDefinition Height="180" /> + <RowDefinition Height="*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Image Source="{Binding Image,Mode=OneWay}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" /> + <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}" Grid.Row="0" Margin="0,0,20,-35" HorizontalAlignment="Right" Width="70" Height="70" VerticalAlignment="Bottom" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" ToolTip="Start This Module"> + <materialDesign:PackIcon Kind="Play" Width="30" Height="30" /> + </Button> + <StackPanel Grid.Row="1" Margin="8,24,8,0"> + <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding Name,Mode=OneWay}"></TextBlock> + <TextBlock VerticalAlignment="Center" Margin="0 5 0 0" FontSize="14" TextWrapping="Wrap" Text="{Binding Description,Mode=OneWay}"></TextBlock> + </StackPanel> + <StackPanel Grid.Row="2" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal"> + <materialDesign:PopupBox Padding="2,0,2,0" Style="{StaticResource MaterialDesignToolPopupBox}"> + <StackPanel> + <Button Content="More" /> + <Button Content="Options" /> + </StackPanel> + </materialDesign:PopupBox> + </StackPanel> + </Grid> + </materialDesign:Card> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Grid> + + <Grid Grid.Row="1" RenderTransformOrigin="0.5,0.5"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="0" ScaleY="0"></ScaleTransform> + </Setter.Value> + </Setter> + <Setter Property="Opacity" Value="0"></Setter> + + <Style.Triggers> + <DataTrigger Binding="{Binding CurrentModule}" Value="{x:Null}"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <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> + </Grid> +</controls:View> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs new file mode 100644 index 000000000..520b69741 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs @@ -0,0 +1,31 @@ +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.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.UI.SupervisingController; +using Tango.SharedUI; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.UI.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : View, IMainView + { + public MainView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml new file mode 100644 index 000000000..487dfe1f8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.ShutdownView" + 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: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="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/Views/ShutdownView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml.cs new file mode 100644 index 000000000..e1d49aec0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Views +{ + /// <summary> + /// Interaction logic for ShutdownView.xaml + /// </summary> + public partial class ShutdownView : UserControl + { + public ShutdownView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/design.ico b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/design.ico Binary files differnew file mode 100644 index 000000000..27b9939df --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/design.ico diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config new file mode 100644 index 000000000..3a7265a72 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="Dragablz" version="0.0.3.197" targetFramework="net46" /> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> + <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> + <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 |
