aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-07 18:30:49 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-07 18:30:49 +0200
commitcf3c535fb0ef3140cc7a3a3c74cadd9b1d519bcf (patch)
tree942ff2f666552dc488095881baa2f3b4c18c1bb1 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views
parente317a7943e47c34e731729eacc46f8ce48905927 (diff)
downloadTango-cf3c535fb0ef3140cc7a3a3c74cadd9b1d519bcf.tar.gz
Tango-cf3c535fb0ef3140cc7a3a3c74cadd9b1d519bcf.zip
Working on users & roles module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/ContactView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml12
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml143
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs23
4 files changed, 175 insertions, 5 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/ContactView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/ContactView.xaml
index dfff19f12..cdfa28c50 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/ContactView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/ContactView.xaml
@@ -17,7 +17,7 @@
<TextBlock>FIRST NAME</TextBlock>
<TextBox Text="{Binding FirstName}"></TextBox>
<TextBlock>LAST NAME</TextBlock>
- <TextBox Text="{Binding FirstName}"></TextBox>
+ <TextBox Text="{Binding LastName}"></TextBox>
<TextBlock>EMAIL</TextBlock>
<TextBox Text="{Binding Email}"></TextBox>
<TextBlock>PHONE NUMBER</TextBlock>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml
index b91a22750..7769f65ed 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml
@@ -37,15 +37,23 @@
<TextBlock FontSize="14" FontWeight="SemiBold">ADDRESS</TextBlock>
- <Border BorderBrush="Gray" BorderThickness="1" Width="300" HorizontalAlignment="Left" Padding="5" Margin="0 10 0 0" Background="#A9FFFFFF">
+ <Border BorderBrush="Gray" BorderThickness="1" Width="300" HorizontalAlignment="Left" Padding="5" Margin="0 10 0 0" Background="#A9FFFFFF" Height="300">
<local:AddressView DataContext="{Binding ManagedOrganization.Address}" />
</Border>
<TextBlock FontSize="14" FontWeight="SemiBold" Margin="0 40 0 0">CONTACT</TextBlock>
- <Border BorderBrush="Gray" BorderThickness="1" Width="300" HorizontalAlignment="Left" Padding="5" Margin="0 10 0 0" Background="#A9FFFFFF">
+ <Border BorderBrush="Gray" BorderThickness="1" Width="300" HorizontalAlignment="Left" Padding="5" Margin="0 10 0 0" Background="#A9FFFFFF" Height="250">
<local:ContactView DataContext="{Binding ManagedOrganization.Contact}" />
</Border>
+
+ <Button Margin="0 40 0 0" MinWidth="160" Height="50" Command="{Binding SaveOrganizationCommand}" Background="Gray" BorderBrush="Gray">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="ContentSave" Width="20" Height="20" />
+ <TextBlock Margin="5 0 0 0" FontSize="16">SAVE</TextBlock>
+ </StackPanel>
+ </Button>
+
</StackPanel>
</Grid>
</Border>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml
index 0a3fec2ff..eaeb180ab 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml
@@ -6,6 +6,7 @@
xmlns:global="clr-namespace:Tango.MachineStudio.UsersAndRoles"
xmlns:vm="clr-namespace:Tango.MachineStudio.UsersAndRoles.ViewModels"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop"
xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
@@ -13,8 +14,146 @@
xmlns:local="clr-namespace:Tango.MachineStudio.UsersAndRoles.Views"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
mc:Ignorable="d"
- d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="Transparent">
+ d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+
<Grid>
- <TextBlock Text="{Binding ManagedUser.Contact.FullName}"></TextBlock>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"/>
+ <ColumnDefinition Width="300"/>
+ </Grid.ColumnDefinitions>
+
+ <Grid Margin="10">
+ <DockPanel Margin="100" MaxWidth="1200">
+ <Grid DockPanel.Dock="Top">
+ <Grid>
+ <StackPanel>
+ <StackPanel Orientation="Horizontal">
+ <Image Source="../Images/user.png" Width="100" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <TextBlock Text="{Binding ManagedUser.Contact.FullName,FallbackValue='Roy Ben Shabat'}" VerticalAlignment="Center" FontSize="30" Margin="10 0 0 0"></TextBlock>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal" Margin="0 10 0 0">
+ <StackPanel>
+ <TextBlock FontSize="16" FontWeight="SemiBold">ADDRESS</TextBlock>
+ <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="5" Height="300">
+ <local:AddressView FontSize="10" />
+ </Border>
+ </StackPanel>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock FontSize="16" FontWeight="SemiBold">CONTACT</TextBlock>
+ <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="5" Height="300">
+ <local:ContactView FontSize="10" />
+ </Border>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+ </Grid>
+ <Grid DockPanel.Dock="Bottom">
+ <Button Margin="0 10 0 0" MinWidth="200" Height="60" Command="{Binding ManageUserCommand}" HorizontalAlignment="Right">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock FontSize="18" VerticalAlignment="Center">SAVE</TextBlock>
+ <materialDesign:PackIcon Margin="5 0 0 0" Kind="ContentSave" Width="30" Height="30" />
+ </StackPanel>
+ </Button>
+ </Grid>
+ <Grid>
+ <DockPanel Margin="0 20 0 0">
+ <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="SemiBold">ROLES</TextBlock>
+ <Grid Margin="0 5 0 0" Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnDropRole">
+ <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Silver" FontSize="20">DRAG &amp; DROP ROLES</TextBlock>
+ <Border BorderBrush="Gray" BorderThickness="1" Padding="10">
+ <ListBox ItemsSource="{Binding ManagedUserRoles}" ItemContainerStyle="{StaticResource basicListBoxItem}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ListBox.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ListBox.ItemsPanel>
+ <ListBox.ItemTemplate>
+ <DataTemplate DataType="{x:Type entities:Role}">
+ <Grid Style="{StaticResource draggableGrid}">
+ <Border Margin="5" CornerRadius="5" Width="100" Height="100" BorderThickness="1" Padding="2" IsHitTestVisible="False">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="BorderBrush" Value="Silver"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
+ <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Border.Background>
+ <LinearGradientBrush>
+ <GradientStop Color="White"/>
+ <GradientStop Color="#FFD6D6D6" Offset="1"/>
+ </LinearGradientBrush>
+ </Border.Background>
+ <Grid>
+ <TextBlock Text="{Binding Name}"></TextBlock>
+ </Grid>
+ </Border>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </Border>
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </DockPanel>
+ </Grid>
+
+ <Grid Grid.Column="1" Background="#A9FFFFFF">
+ <DockPanel Margin="10">
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
+ <Image Source="../Images/roles.png" Width="70" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <TextBlock FontSize="16" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">AVAILABLE ROLES</TextBlock>
+ </StackPanel>
+
+ <Grid>
+ <ListBox ItemsSource="{Binding Roles}" ItemContainerStyle="{StaticResource basicListBoxItem}" HorizontalContentAlignment="Stretch" Background="Transparent">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid Background="Transparent" IsHitTestVisible="True" Style="{StaticResource draggableGrid}" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}">
+ <DockPanel>
+ <Border DockPanel.Dock="Left" Width="100" Height="100" IsHitTestVisible="False" BorderBrush="Silver" BorderThickness="1" CornerRadius="5" Margin="5" Padding="2">
+ <Border.Background>
+ <LinearGradientBrush>
+ <GradientStop Color="White"/>
+ <GradientStop Color="#FFD6D6D6" Offset="1"/>
+ </LinearGradientBrush>
+ </Border.Background>
+ <Grid>
+ <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
+ <Image Source="../Images/roles.png" Width="32" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" TextAlignment="Center" FontSize="13" FontWeight="SemiBold" Margin="5"></TextBlock>
+ </StackPanel>
+ </Grid>
+ </Border>
+ <Grid>
+ <ItemsControl ItemsSource="{Binding RolesPermissions}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="Security" Width="16" />
+ <TextBlock Text="{Binding Permission.Name}"></TextBlock>
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </Grid>
+
+ <dragAndDrop:DraggingSurface x:Name="dragSurface" />
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs
index 88319cbb3..b26f0ea03 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs
@@ -12,6 +12,9 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.BL.Entities;
+using Tango.DragAndDrop;
+using Tango.MachineStudio.UsersAndRoles.ViewModels;
namespace Tango.MachineStudio.UsersAndRoles.Views
{
@@ -20,9 +23,29 @@ namespace Tango.MachineStudio.UsersAndRoles.Views
/// </summary>
public partial class UserManagementView : UserControl
{
+ private MainViewVM _vm;
+
+ public DraggingSurface DraggingSurface
+ {
+ get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); }
+ set { SetValue(DraggingSurfaceProperty, value); }
+ }
+ public static readonly DependencyProperty DraggingSurfaceProperty =
+ DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(UserManagementView), new PropertyMetadata(null));
+
public UserManagementView()
{
InitializeComponent();
+ DraggingSurface = dragSurface;
+ Loaded += (_, __) => _vm = DataContext as MainViewVM;
+ }
+
+ private void OnDropRole(object sender, DropEventArgs e)
+ {
+ if (e.Draggable.DataContext is Role)
+ {
+ _vm.OnDropRole(e.Draggable.DataContext as Role);
+ }
}
}
}