aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2019-12-26 14:37:37 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2019-12-26 14:37:37 +0200
commit8522f980648f1da4a1754822d10b84b4a9d2a522 (patch)
treec63049d7bdb4fb96c8c61f9d1933c2e8b24c8c72 /Software/Visual_Studio/MachineStudio/Modules
parent1ef776620088308e380a69271518c2c66fd673a0 (diff)
downloadTango-8522f980648f1da4a1754822d10b84b4a9d2a522.tar.gz
Tango-8522f980648f1da4a1754822d10b84b4a9d2a522.zip
Action Logs View, added copy button, changes GUI alignments and styles
Related Work Items: #2213
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml181
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml.cs5
3 files changed, 139 insertions, 56 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs
index 5f2d86b40..7be4dd691 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/ViewModels/MainViewVM.cs
@@ -89,11 +89,13 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels
public RelayCommand SearchCommand { get; set; }
public RelayCommand CopyToClipBoardCommand { get; set; }
+ public RelayCommand CopyRelateObjectIDCommand { get; set; }
public MainViewVM()
{
ActionLogs = new ObservableCollection<ActionLog>();
SearchCommand = new RelayCommand(GetActionLogs, ()=> !IsRunning);
+ CopyRelateObjectIDCommand = new RelayCommand(CopyRelateObjectID);
CopyToClipBoardCommand = new RelayCommand(CopyToClipBoard, () => SelectedActionLog != null && SelectedActionLog.DifferenceObject != null);
DateTime now = DateTime.Now;
StartSelectedDate = now.AddMonths(-1);
@@ -116,7 +118,12 @@ namespace Tango.MachineStudio.ActionLogs.ViewModels
System.Windows.Clipboard.SetDataObject(data);
}
-
+ private void CopyRelateObjectID()
+ {
+ DataObject data = new DataObject(SelectedActionLog.RelatedObjectGuid);
+ System.Windows.Clipboard.SetDataObject(data);
+ }
+
/// <summary>
/// New Database Query with search parameters. Initialization ActionLogs property.
/// </summary>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml
index 60ce2560c..bc7aa926b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml
@@ -10,16 +10,18 @@
xmlns:vm="clr-namespace:Tango.MachineStudio.ActionLogs.ViewModels"
xmlns:global="clr-namespace:Tango.MachineStudio.ActionLogs"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
xmlns:diff="clr-namespace:Tango.BL.ValueObjects;assembly=Tango.BL"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
<UserControl.Resources>
<sharedConverters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
+ <sharedConverters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter"/>
</UserControl.Resources>
<Grid IsEnabled="{Binding IsFree}">
<Grid.RowDefinitions>
- <RowDefinition Height="300"/>
+ <RowDefinition Height="200"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="70"></TextBlock>
@@ -33,12 +35,13 @@
<ColumnDefinition Width ="3*"/>
</Grid.ColumnDefinitions >
- <Grid x:Name ="SearchButtons" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch">
- <Border Padding="8" BorderBrush="DimGray" BorderThickness="0" Background="{StaticResource Logging.Background}" HorizontalAlignment="Stretch" CornerRadius="2">
+ <Grid x:Name ="searchButtons" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Stretch">
+ <Border Padding="14 14 12 14" BorderBrush="DimGray" BorderThickness="0" Background="{StaticResource Logging.Background}" HorizontalAlignment="Stretch" CornerRadius="2" >
<Border.Effect>
<DropShadowEffect ShadowDepth="4" BlurRadius="10" Opacity="0.5"/>
</Border.Effect>
- <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Horizontal">
+ <DockPanel>
+ <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Horizontal">
<StackPanel >
<TextBlock FontSize="10">Start Date:</TextBlock>
<DatePicker x:Name="startdatePicker" SelectedDate="{Binding StartSelectedDate}" materialDesign:HintAssist.Hint="Pick start date" Width="160" VerticalAlignment="Center" FontSize="16" />
@@ -49,50 +52,54 @@
</StackPanel>
<DockPanel Margin="50 0 0 0" >
<TextBlock DockPanel.Dock="Top" Text="Action Log Type:" VerticalAlignment="Center" FontSize="10"></TextBlock>
- <ToggleButton Width="200" Margin="0 5 0 0">
- <ToggleButton.Template>
- <ControlTemplate>
- <Grid>
- <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black">
- <DockPanel>
- <materialDesign:PackIcon Width="16" Height="16" DockPanel.Dock="Right" Kind="ChevronDown" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" />
- <TextBlock VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}">
- <Run Text=" Select Actions"></Run>
- <Run>(</Run><Run Text="{Binding SelectedActionLogTypes.SynchedSource.Count,Mode=OneWay}"></Run><Run>)</Run>
- </TextBlock>
- </DockPanel>
- </Border>
- <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked}" >
- <Border Padding="5" Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}">
- <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}">
- <ItemsControl ItemsSource="{Binding SelectedActionLogTypes}" Foreground="{StaticResource MainWindow.Foreground}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <DockPanel Margin="2">
- <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" />
- <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
- </DockPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
+ <ToggleButton Width="200" Margin="0 5 0 0" x:Name="selectActionsButton">
+ <ToggleButton.Template>
+ <ControlTemplate>
+ <Grid>
+ <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" >
+ <DockPanel>
+ <Button Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="Button_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}">
+ <materialDesign:PackIcon Width="16" Height="16" Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/>
+ </Button>
+ <TextBlock VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}">
+ <Run Text=" Select Actions"></Run>
+ <Run>(</Run><Run Text="{Binding SelectedActionLogTypes.SynchedSource.Count,Mode=OneWay}"></Run><Run>)</Run>
+ </TextBlock>
+ </DockPanel>
</Border>
- </Popup>
- </Grid>
- </ControlTemplate>
- </ToggleButton.Template>
- </ToggleButton>
- </DockPanel>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="50 10 0 0">
- <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/>
- <TextBox Width="Auto" materialDesign:HintAssist.Hint="Search by ID, user, related object name" Text="{Binding SearchFilter,UpdateSourceTrigger=PropertyChanged}" />
+ <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" >
+ <Border Padding="5" Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}">
+ <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}">
+ <ItemsControl ItemsSource="{Binding SelectedActionLogTypes}" Foreground="{StaticResource MainWindow.Foreground}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <DockPanel Margin="2">
+ <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" />
+ <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
+ </DockPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </Border>
+ </Popup>
+ </Grid>
+ </ControlTemplate>
+ </ToggleButton.Template>
+ </ToggleButton>
+
+ </DockPanel>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="50 10 0 0">
+ <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/>
+ <TextBox Width="Auto" materialDesign:HintAssist.Hint="Search by ID, user, related object name" Text="{Binding SearchFilter,UpdateSourceTrigger=PropertyChanged}" />
+ </StackPanel>
</StackPanel>
- </StackPanel>
+ <Button DockPanel.Dock="Right" Width="120" HorizontalAlignment="Right" Command="{Binding SearchCommand}" Margin="10 0 10 0" VerticalAlignment="Center">Search</Button>
+ </DockPanel>
</Border>
- <Button Width="120" HorizontalAlignment="Right" Command="{Binding SearchCommand}" Margin="10 0 10 0" VerticalAlignment="Center">Search</Button>
</Grid>
- <Grid IsEnabled="{Binding IsFree}" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Stretch" >
+ <Grid IsEnabled="{Binding IsFree}" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<DataGrid Margin="0 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" RowHeight="40" BorderBrush="{StaticResource borderBrush}" IsReadOnly="True" BorderThickness="1"
Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserReorderColumns="True"
CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding ActionLogs}"
@@ -102,6 +109,11 @@
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ </Trigger>
+ </Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.RowStyle>
@@ -124,12 +136,64 @@
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding ID}" Width="40" />
+ <DataGridTextColumn Header="TIME" Binding="{Binding LastUpdated, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" />
<DataGridTextColumn Header="ACTION" Binding="{Binding ActionType, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto"/>
<DataGridTextColumn Header="USER" Binding="{Binding User.Contact.FullName}" Width="Auto"/>
<DataGridTextColumn Header="RELATED OBJECT NAME" Binding="{Binding RelatedObjectName}" Width="Auto" />
- <DataGridTextColumn Header="RELATED OBJECT ID" Binding="{Binding RelatedObjectGuid}" Width="Auto" />
+ <DataGridTextColumn Header="RELATED OBJECT ID" Binding="{Binding RelatedObjectGuid}" Width="Auto" >
+ <DataGridTextColumn.CellStyle>
+ <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}" >
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+ <Setter Property="Tag" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=DataContext}"/>
+ <Setter Property="ContextMenu">
+ <Setter.Value>
+ <ContextMenu DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}" Padding="0" Margin="0" >
+ <MenuItem Header="Copy (Ctrl+C)" Command="{Binding CopyRelateObjectIDCommand}" FontSize="12" Background="{StaticResource MainWindow.Background}">
+ <MenuItem.Icon>
+ <materialDesign:PackIcon Width="16" Height="16" Kind="ContentCopy" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}"/>
+ </MenuItem.Icon>
+ <MenuItem.ItemContainerStyle>
+ <Style TargetType="MenuItem" BasedOn="{StaticResource MaterialDesignMenuItem}">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ <Style.Triggers>
+ <Trigger Property="IsMouseOver" Value="True">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </MenuItem.ItemContainerStyle>
+ </MenuItem>
+ <ContextMenu.Style>
+ <Style TargetType="{x:Type ContextMenu}" BasedOn="{StaticResource MaterialDesignMenu}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate >
+ <AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
+ <Border Background="{StaticResource MainWindow.Background}" Effect="{DynamicResource MaterialDesignShadowDepth1}" Margin="3" CornerRadius="2">
+ <Grid RenderOptions.ClearTypeHint="Enabled" Margin="0">
+ <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
+ </Grid>
+ </Border>
+ </AdornerDecorator>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </ContextMenu.Style>
+ </ContextMenu>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </DataGridTextColumn.CellStyle>
+ </DataGridTextColumn>
<DataGridTextColumn Header="MESSAGE" Binding="{Binding Message}" Width="1*" />
- <DataGridTextColumn Header="TIME" Binding="{Binding LastUpdated}" Width="1*" />
</DataGrid.Columns>
</DataGrid>
</Grid>
@@ -140,23 +204,30 @@
</StackPanel>
</Grid>
- <Border Grid.Row="0" Grid.Column="1" Margin="40 6 11 8" Padding="8" BorderBrush="DimGray" BorderThickness="0" Background="{StaticResource Logging.Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="2">
+ <Grid Grid.Row="0" Grid.Column="1" Margin="40 0 10 0">
+ <Border Padding="14 14 12 14" BorderBrush="DimGray" BorderThickness="0" Background="{StaticResource Logging.Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="2">
<Border.Effect>
<DropShadowEffect ShadowDepth="4" BlurRadius="10" Opacity="0.5"/>
</Border.Effect>
- <DockPanel VerticalAlignment="Center" HorizontalAlignment="Stretch" >
- <Button Width="Auto" HorizontalAlignment="Right" DockPanel.Dock="Right" Command="{Binding CopyToClipBoardCommand}">Copy to clipboard</Button>
- <TextBlock DockPanel.Dock="Top" Margin="10 5 0 0" Foreground="{StaticResource DimGrayBrush}" FontSize="16" VerticalAlignment="Center">Object Changes</TextBlock>
- </DockPanel>
- </Border>
- <Border Grid.Row="1" Grid.Column="1" Margin="40 0 10 10" IsEnabled="{Binding IsFree}" BorderThickness="1" BorderBrush="{StaticResource BorderBrushGainsboro}" >
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Left" Margin="10 0 0 0" Foreground="{StaticResource DimGrayBrush}" FontSize="16" VerticalAlignment="Center" Width="150">Object Changes</TextBlock>
+ <Button Width="Auto" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Right" DockPanel.Dock="Right" Command="{Binding CopyToClipBoardCommand}" >
+ <StackPanel Orientation="Horizontal" >
+ <materialDesign:PackIcon Width="16" Height="16" Kind="ContentCopy" VerticalAlignment="Center" Margin="-5 0 10 0"/>
+ <TextBlock Text="Copy to Clipboard" VerticalAlignment="Center"></TextBlock>
+ </StackPanel>
+ </Button>
+ </DockPanel>
+ </Border>
+ </Grid>
+ <Border Grid.Row="1" Grid.Column="1" Margin="40 0 10 10" IsEnabled="{Binding IsFree}" BorderThickness="1 0 1 1 " BorderBrush="{StaticResource LightGrayBrush100}" >
<DockPanel >
<TextBlock DockPanel.Dock="Top" Height="40" Text="{Binding DifferenceObject.Name, Mode=OneWay}" VerticalAlignment="Center" Padding="5" FontSize="18" HorizontalAlignment="Center"></TextBlock>
<TreeView x:Name="treeView" ItemsSource="{Binding DifferenceObject.Children, Mode=OneWay}" Background="{StaticResource TransparentBackgroundBrush}" >
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}">
<Setter Property="IsExpanded" Value="True" />
- <Setter Property="Background" Value="Transparent"></Setter>
+
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent"></Setter>
@@ -172,11 +243,11 @@
</TreeView.ItemContainerStyle>
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type diff:ActionLogDifference}" ItemsSource="{Binding Children}">
- <TextBlock Text="{Binding Name}" Margin="5 0 0 0" ToolTip="{Binding}" />
+ <TextBlock Text="{Binding Name}" Margin="5 0 0 0" Foreground ="{StaticResource MainWindow.Foreground}"/>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type diff:ActionLogDifferenceValue}">
- <TextBlock Margin="5 0 0 0" ToolTip="{Binding}">
+ <TextBlock Margin="5 0 0 0" Foreground ="{StaticResource MainWindow.Foreground}">
<Run Text="{Binding Name}"/>
<Run>: </Run>
<Run Text="{Binding Before,Mode=OneWay}" Foreground="{StaticResource DimGrayBrush}"/>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml.cs
index 76ab27d30..67641e3fc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml.cs
@@ -25,5 +25,10 @@ namespace Tango.MachineStudio.ActionLogs.Views
InitializeComponent();
}
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ selectActionsButton.IsChecked = true;
+ e.Handled = true;
+ }
}
}