aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-01-07 16:09:29 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-01-07 16:09:29 +0200
commitfc50a3a0f5c1a7de61dd169ca175f3690177059a (patch)
tree8efd928c974806957fd06d4bfdcafbfc45268cb6
parent3f5ba302842a906950b118c7f6683c061819d76e (diff)
downloadTango-fc50a3a0f5c1a7de61dd169ca175f3690177059a.tar.gz
Tango-fc50a3a0f5c1a7de61dd169ca175f3690177059a.zip
Implemented LogOut from machine studio.
Modified Machine Designer image. Fixed issue with updating contact on DB Module. Improved Machine Studio Drawer graphics.
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin8388608 -> 8388608 bytes
-rw-r--r--Software/Graphics/machine-designer-module.jpgbin0 -> 65429 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/machine-designer-module.jpgbin0 -> 65429 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj3
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml94
9 files changed, 87 insertions, 37 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index 103b0a180..302447af9 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index 756256e15..7357b4306 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Graphics/machine-designer-module.jpg b/Software/Graphics/machine-designer-module.jpg
new file mode 100644
index 000000000..0b2351fb2
--- /dev/null
+++ b/Software/Graphics/machine-designer-module.jpg
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs
index 6f44d51f0..848cb1187 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ContactsViewVM.cs
@@ -15,8 +15,12 @@ namespace Tango.MachineStudio.DB.ViewModels
{
}
+
+
protected override void OnValidating()
{
+ EditEntity.FullName = EditEntity.FirstName + " " + EditEntity.LastName;
+
base.OnValidating();
if (!EditEntity.Email.IsEmail())
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/machine-designer-module.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/machine-designer-module.jpg
new file mode 100644
index 000000000..0b2351fb2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/machine-designer-module.jpg
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs
index e7b343db8..db937028b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs
@@ -18,7 +18,7 @@ namespace Tango.MachineStudio.MachineDesigner
public string Description => "Provides a graphical control over machine configurations. Create, manage and deploy machine configurations using simple drag and drop interface.";
- public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/machine-sketch.png");
+ public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/machine-designer-module.jpg");
public FrameworkElement MainView => new MainView();
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
index a2c955d30..46ec20fdc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
@@ -207,5 +207,8 @@
<ItemGroup>
<Resource Include="Images\application-firmware.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\machine-designer-module.jpg" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
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 92c0afa21..061420037 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -11,6 +11,7 @@ using Tango.Logging;
using Tango.MachineStudio.Common;
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.SupervisingController;
@@ -24,6 +25,7 @@ namespace Tango.MachineStudio.UI.ViewModels
public class MainViewVM : ViewModel<IMainView>
{
private IStudioModule _currentModule;
+ private INavigationManager _navigation;
private bool _isDisconnecting;
public IStudioModule CurrentModule
@@ -57,6 +59,8 @@ namespace Tango.MachineStudio.UI.ViewModels
public RelayCommand DisconnectCommand { get; set; }
+ public RelayCommand SignoutCommand { get; set; }
+
private IAuthenticationProvider _authenticationProvider;
public IAuthenticationProvider AuthenticationProvider
{
@@ -95,8 +99,10 @@ namespace Tango.MachineStudio.UI.ViewModels
IAuthenticationProvider authenticationProvider,
IStudioModuleLoader studioModuleLoader,
INotificationProvider notificationProvider,
- IStudioApplicationManager applicationManager) : base(view)
+ IStudioApplicationManager applicationManager,
+ INavigationManager navigationManager) : base(view)
{
+ _navigation = navigationManager;
AuthenticationProvider = authenticationProvider;
StudioModuleLoader = studioModuleLoader;
NotificationProvider = notificationProvider;
@@ -106,7 +112,8 @@ namespace Tango.MachineStudio.UI.ViewModels
HomeCommand = new RelayCommand(Home);
ConnectCommand = new RelayCommand(ConnectToMachine);
- DisconnectCommand = new RelayCommand(DisconnectFromMachine,(x) => ApplicationManager.IsMachineConnected && !_isDisconnecting);
+ SignoutCommand = new RelayCommand(SignOut);
+ DisconnectCommand = new RelayCommand(DisconnectFromMachine, (x) => ApplicationManager.IsMachineConnected && !_isDisconnecting);
}
private async void DisconnectFromMachine()
@@ -122,13 +129,21 @@ namespace Tango.MachineStudio.UI.ViewModels
}
}
+ private void SignOut()
+ {
+ _authenticationProvider.Logout();
+ _navigation.NavigateTo(NavigationView.LoginView);
+ CurrentModule = null;
+ IsMenuOpened = false;
+ }
+
private void ConnectToMachine()
{
_notificationProvider.ShowModalDialog<MachineConnectionViewVM>((x) =>
{
if (x.SelectedMachine != null)
{
- _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
+ _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
{
using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "..."))
{
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 14858c049..d7d0f8dc3 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
@@ -29,52 +29,80 @@
<materialDesign:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
<materialDesign:DrawerHost.LeftDrawerContent>
- <StackPanel MinWidth="300">
- <Grid>
- <ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
+ <DockPanel LastChildFill="False">
+ <StackPanel MinWidth="300" DockPanel.Dock="Top">
+ <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 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" FontStyle="Italic" 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>
- </Grid>
- <StackPanel Margin="0 16 0 0">
+ <StackPanel Margin="10 10 0 0">
+ <TextBlock Foreground="Silver" FontSize="16" FontWeight="Bold" FontStyle="Italic">MODULES</TextBlock>
+ <Separator Background="Gainsboro" />
+ </StackPanel>
+ <ListBox ItemsSource="{Binding StudioModuleLoader.UserModules}" HorizontalContentAlignment="Stretch" FontSize="14">
+ <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>
+
+ <StackPanel Orientation="Horizontal" Margin="0 0 0 0" ToolTip="{Binding Description}">
+ <Ellipse Height="35" Width="35" VerticalAlignment="Center">
+ <Ellipse.Fill>
+ <ImageBrush ImageSource="{Binding Image}" RenderOptions.BitmapScalingMode="Fant" />
+ </Ellipse.Fill>
+ </Ellipse>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Name}"></TextBlock>
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </StackPanel>
+
+ <StackPanel DockPanel.Dock="Bottom">
+ <Separator Margin="0 10 0 0" Background="Gainsboro" />
<ListBoxItem>
<i:Interaction.Triggers>
<i:EventTrigger EventName="PreviewMouseUp">
- <i:InvokeCommandAction Command="{Binding HomeCommand}"></i:InvokeCommandAction>
+ <i:InvokeCommandAction Command="{Binding SignoutCommand}"></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>
+ <materialDesign:PackIcon VerticalAlignment="Center" Kind="Logout" Width="32" Height="32"></materialDesign:PackIcon>
+ <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Sign out</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>
+ </DockPanel>
</materialDesign:DrawerHost.LeftDrawerContent>
<DockPanel>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2"