aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views
diff options
context:
space:
mode:
authorRoy <roy.mail.net@gmail.com>2017-12-15 03:34:09 +0200
committerRoy <roy.mail.net@gmail.com>2017-12-15 03:34:09 +0200
commit27fe2f3f63191ecefbb00f16acf2b8b089a30d83 (patch)
treed861255d3c0596b321c213b1ed64225bfed434dd /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views
parentad35c9c2df0001157ea13312382f3cdfdad67f06 (diff)
downloadTango-27fe2f3f63191ecefbb00f16acf2b8b089a30d83.tar.gz
Tango-27fe2f3f63191ecefbb00f16acf2b8b089a30d83.zip
Added Login.
Implemented message boxes through notification provider. Implemented VM auto validation using data annotation.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml31
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml50
4 files changed, 87 insertions, 17 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml
index ab0875023..13a705895 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml
@@ -15,7 +15,7 @@
<TextBlock FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock>
</StackPanel>
<TextBlock HorizontalAlignment="Right" FontSize="18" Margin="0 0 -50 0" Foreground="{StaticResource AccentColorBrush}">Twine Solutions</TextBlock>
- <mahapps:ProgressRing Margin="20 60 20 20" Width="80" Height="80"></mahapps:ProgressRing>
+ <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80"></mahapps:ProgressRing>
<TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic">Loading, please wait...</TextBlock>
</StackPanel>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml
index 60590a16b..046c34183 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml
@@ -2,17 +2,40 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:rules="clr-namespace:Tango.MachineStudio.Common.ValidationRules;assembly=Tango.MachineStudio.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280" DataContext="{Binding LoginViewVM, Source={StaticResource Locator}}" Background="White">
+
+ <UserControl.Resources>
+ <rules:Required x:Key="Required"></rules:Required>
+ </UserControl.Resources>
+
+
+ <UserControl.InputBindings>
+ <KeyBinding Key="Return" Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}"></KeyBinding>
+ </UserControl.InputBindings>
<Grid>
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300">
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40">
<Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image>
- <TextBox Margin="0 40 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged}" />
- <PasswordBox x:Name="txtPass" Margin="0 20 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" />
- <Button Margin="0 40 0 0" Height="50" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=txtPass}">LOGIN</Button>
+ <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock>
+ </StackPanel>
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Margin="0 120 0 0">
+ <TextBlock HorizontalAlignment="Center" FontSize="24">Login to your account</TextBlock>
+ <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" Width="100" Margin="0 20 0 0"></Image>
+ <DockPanel Margin="0 20 0 0">
+ <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtEmail, Path=BorderBrush}" Kind="EmailOutline" />
+ <TextBox x:Name="txtEmail" IsTabStop="True" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged,ValidatesOnNotifyDataErrors=True}" AutomationProperties.IsRequiredForForm="True" />
+ </DockPanel>
+ <DockPanel Margin="0 20 0 0">
+ <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtPass, Path=BorderBrush}" Kind="Key" />
+ <PasswordBox x:Name="txtPass" PasswordChanged="txtPass_PasswordChanged" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" />
+ </DockPanel>
+ <Button Margin="0 40 0 0" Height="50" Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Content="LOGIN">
+
+ </Button>
</StackPanel>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs
index 0b3a9ae4f..a57594d75 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs
@@ -12,17 +12,36 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using static Tango.SharedUI.Controls.MultiTransitionControl;
namespace Tango.MachineStudio.UI.Views
{
/// <summary>
/// Interaction logic for LoginView.xaml
/// </summary>
- public partial class LoginView : UserControl
+ public partial class LoginView : UserControl, ITransitionView
{
public LoginView()
{
InitializeComponent();
}
+
+ 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();
+ }
+
+ private void txtPass_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ Password = txtPass.Password;
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
index 98b6ecb73..ba3ec16fb 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
@@ -7,6 +7,7 @@
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"
@@ -14,25 +15,52 @@
<Grid>
<materialDesign:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
<materialDesign:DrawerHost.LeftDrawerContent>
- <DockPanel MinWidth="212">
- <Grid DockPanel.Dock="Top">
+ <StackPanel MinWidth="300">
+ <Grid>
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
HorizontalAlignment="Right" Margin="16"
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
<StackPanel Margin="5 0 0 0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
- <materialDesign:PackIcon VerticalAlignment="Center" Kind="Account" Foreground="{StaticResource AccentColorBrush}" Width="32" Height="32"></materialDesign:PackIcon>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center">User Name</TextBlock>
+ <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image>
+ <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock>
</StackPanel>
</Grid>
- <ListBox x:Name="DemoItemsListBox" Margin="0 16 0 16" SelectedIndex="0">
- <Button Command="{Binding HomeCommand}" Style="{DynamicResource MaterialDesignFlatButton}">Home</Button>
- <ListBoxItem>Item 2</ListBoxItem>
- <ListBoxItem>Item 3</ListBoxItem>
- <ListBoxItem>Item 4</ListBoxItem>
- <ListBoxItem>Item 5</ListBoxItem>
+ <StackPanel Margin="0 16 0 0">
+ <ListBoxItem>
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="PreviewMouseUp">
+ <i:InvokeCommandAction Command="{Binding HomeCommand}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon VerticalAlignment="Center" Kind="Home" Width="32" Height="32"></materialDesign:PackIcon>
+ <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Home</TextBlock>
+ </StackPanel>
+ </ListBoxItem>
+ </StackPanel>
+ <ListBox ItemsSource="{Binding StudioModuleLoader.UserModules}" HorizontalContentAlignment="Stretch">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
+ <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter>
+ </Style>
+ </ListBox.ItemContainerStyle>
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid Background="Transparent">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="PreviewMouseUp">
+ <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}"></i:InvokeCommandAction>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+
+ <TextBlock Text="{Binding Name}" ToolTip="{Binding Description}"></TextBlock>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
</ListBox>
- </DockPanel>
+ </StackPanel>
</materialDesign:DrawerHost.LeftDrawerContent>
<DockPanel>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2"