diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-14 19:48:41 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-14 19:48:41 +0200 |
| commit | ad35c9c2df0001157ea13312382f3cdfdad67f06 (patch) | |
| tree | 78c4708893f6207ff692f729ac43408823f963e1 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 7887ca0ad2433c4adbb65d96bf926561405ab290 (diff) | |
| download | Tango-ad35c9c2df0001157ea13312382f3cdfdad67f06.tar.gz Tango-ad35c9c2df0001157ea13312382f3cdfdad67f06.zip | |
Implemented IAuthenticationProvider, INavigationProvider, IModuleLoader.
LoadingView,
LoginView,
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
17 files changed, 483 insertions, 35 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs 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/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index a425345dc..963b9eb8b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -6,13 +6,29 @@ 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> - <views:MainView></views:MainView> + <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/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/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 6c008797f..9d2860241 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -96,16 +96,31 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </ApplicationDefinition> + <Compile Include="Authentication\DefaultAuthenticationProvider.cs" /> + <Compile Include="Modules\DefaultStudioModuleLoader.cs" /> + <Compile Include="Navigation\DefaultNavigationManager.cs" /> <Compile Include="Notifications\DefaultNotificationProvider.cs" /> <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> @@ -125,6 +140,14 @@ <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> @@ -133,6 +156,10 @@ <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"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 1f08e31ca..5095dfc93 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -3,7 +3,13 @@ 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.UI.Authentication; +using Tango.MachineStudio.UI.Modules; +using Tango.MachineStudio.UI.Navigation; using Tango.MachineStudio.UI.Notifications; using Tango.MachineStudio.UI.SupervisingController; using Tango.MachineStudio.UI.ViewModels; @@ -35,9 +41,20 @@ namespace Tango.MachineStudio.UI //// SimpleIoc.Default.Register<IDataService, DataService>(); ////} - SimpleIoc.Default.Register<INotificationProvider>(() => new DefaultNotificationProvider()); + SimpleIoc.Default.Unregister<INotificationProvider>(); + SimpleIoc.Default.Unregister<IAuthenticationProvider>(); + SimpleIoc.Default.Unregister<INavigationManager>(); + SimpleIoc.Default.Unregister<IStudioModuleLoader>(); + + SimpleIoc.Default.Register<INotificationProvider, DefaultNotificationProvider>(); + SimpleIoc.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); + SimpleIoc.Default.Register<INavigationManager, DefaultNavigationManager>(); + SimpleIoc.Default.Register<IStudioModuleLoader, DefaultStudioModuleLoader>(); SimpleIoc.Default.Register<MainViewVM>(); + SimpleIoc.Default.Register<LoadingViewVM>(); + SimpleIoc.Default.Register<ShutdownViewVM>(); + SimpleIoc.Default.Register<LoginViewVM>(); //Register View (Supervising Controller Pattern). if (!ViewModelBase.IsInDesignModeStatic) @@ -54,5 +71,29 @@ namespace Tango.MachineStudio.UI 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..72ab5aca9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common.Navigation; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class LoadingViewVM : ViewModel + { + public LoadingViewVM(INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader) + { + Task.Factory.StartNew(() => + { + Thread.Sleep(3000); + }).ContinueWith((x) => + { + + studioModuleLoader.LoadModules(); + navigationManager.NavigateTo(NavigationView.LoginView); + + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + } +} 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..67c116790 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Tango.Core.Commands; +using Tango.MachineStudio.Common.Authentication; +using Tango.MachineStudio.Common.Navigation; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class LoginViewVM : ViewModel + { + private IAuthenticationProvider _authenticationProvider; + private INavigationManager _navigationManager; + + private String _email; + public String Email + { + get { return _email; } + set { _email = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand<PasswordBox> LoginCommand { get; set; } + + public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager) + { + _navigationManager = navigationManager; + _authenticationProvider = authenticationProvider; + LoginCommand = new RelayCommand<PasswordBox>(Login); + } + + private void Login(PasswordBox passwordBox) + { + String password = passwordBox.Password; + try + { + _authenticationProvider.Login(Email, password); + _navigationManager.NavigateTo(NavigationView.MainView); + } + catch (Exception ex) + { + MessageBox.Show("Failed"); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index e0aff5be3..213d1a83d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -8,6 +8,8 @@ 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.UI.SupervisingController; using Tango.SharedUI; @@ -15,8 +17,6 @@ namespace Tango.MachineStudio.UI.ViewModels { public class MainViewVM : ViewModel<IMainView> { - public ObservableCollection<IStudioModule> Modules { get; set; } - private IStudioModule _currentModule; public IStudioModule CurrentModule @@ -37,43 +37,29 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand HomeCommand { get; set; } - public String Text { get; set; } - - public MainViewVM(IMainView view) : base(view) + private IAuthenticationProvider _authenticationProvider; + public IAuthenticationProvider AuthenticationProvider { - Modules = new ObservableCollection<IStudioModule>(); - - LoadModules(); - - Text = "Hi ROy"; + get { return _authenticationProvider; } + set { _authenticationProvider = value; RaisePropertyChangedAuto(); } + } - StartModuleCommand = new RelayCommand<IStudioModule>(StartModule); + private IStudioModuleLoader _studioModuleLoader; - HomeCommand = new RelayCommand(Home); + public IStudioModuleLoader StudioModuleLoader + { + get { return _studioModuleLoader; } + set { _studioModuleLoader = value; RaisePropertyChangedAuto(); } } - private void LoadModules() + public MainViewVM(IMainView view, IAuthenticationProvider authenticationProvider, IStudioModuleLoader studioModuleLoader) : base(view) { - string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + AuthenticationProvider = authenticationProvider; + StudioModuleLoader = studioModuleLoader; - foreach (var file in Directory.GetFiles(assemblyFolder, "*.dll").Where(x => x.Contains("MachineStudio"))) - { - try - { - Assembly moduleAssembly = null; - moduleAssembly = Assembly.LoadFrom(file); + StartModuleCommand = new RelayCommand<IStudioModule>(StartModule); - if (moduleAssembly != null) - { - foreach (var moduleType in moduleAssembly.GetTypes().Where(x => !x.IsInterface && typeof(IStudioModule).IsAssignableFrom(x))) - { - var module = Activator.CreateInstance(moduleType) as IStudioModule; - Modules.Add(module); - } - } - } - catch { } - } + HomeCommand = new RelayCommand(Home); } private void Home() 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..ab0875023 --- /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" 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 20" 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..60590a16b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml @@ -0,0 +1,18 @@ +<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: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"> + <Grid> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300"> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> + <TextBox Margin="0 40 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged}" /> + <PasswordBox x:Name="txtPass" Margin="0 20 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" /> + <Button Margin="0 40 0 0" Height="50" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=txtPass}">LOGIN</Button> + </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..0b3a9ae4f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.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 LoginView.xaml + /// </summary> + public partial class LoginView : UserControl + { + public LoginView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index ad366ce9a..98b6ecb73 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -74,7 +74,7 @@ <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 Modules}" Grid.Row="2" Margin="10"> + <ItemsControl ItemsSource="{Binding StudioModuleLoader.UserModules}" Grid.Row="2" Margin="10"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel IsItemsHost="True"></WrapPanel> 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..20329ef25 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml @@ -0,0 +1,12 @@ +<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:local="clr-namespace:Tango.MachineStudio.UI.Views" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300" DataContext="{Binding ShutdownViewVM, Source={StaticResource Locator}}"> + <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(); + } + } +} |
