aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ActionLogs/Views/MainView.xaml
blob: 60ce2560c82417c4f553f9d0506737262ea74f44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<UserControl x:Class="Tango.MachineStudio.ActionLogs.Views.MainView"
             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.ActionLogs.Views"
             xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
             xmlns:vm="clr-namespace:Tango.MachineStudio.ActionLogs.ViewModels"
             xmlns:global="clr-namespace:Tango.MachineStudio.ActionLogs"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             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" />
    </UserControl.Resources>
    <Grid IsEnabled="{Binding IsFree}">
        <Grid.RowDefinitions>
            <RowDefinition Height="300"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="70"></TextBlock>
        <Grid Grid.Row="1" Margin="40 0 40 40">
            <Grid.RowDefinitions>
                <RowDefinition Height="70"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition  Width ="7*"/>
                <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">
                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="4" BlurRadius="10" Opacity="0.5"/>
                    </Border.Effect>
                    <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" />
                        </StackPanel>
                        <StackPanel   Margin="50 0 0 0">
                            <TextBlock FontSize="10">End Date:</TextBlock>
                            <DatePicker x:Name="endDatePicker"  SelectedDate="{Binding EndSelectedDate}" materialDesign:HintAssist.Hint="Pick end date"  Width="160" VerticalAlignment="Center" FontSize="16" />
                        </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>
                                                </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>
                </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" >
                <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}" 
                           SelectedItem="{Binding SelectedActionLog}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" FontSize="11">
                    <DataGrid.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>
                        </Style>
                    </DataGrid.CellStyle>
                    <DataGrid.RowStyle>
                        <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="Transparent"></Setter>
                                    <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" />
                                    <Setter Property="Cursor" Value="Hand"></Setter>
                                </Trigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="Background" Value="Transparent"></Setter>
                                </Trigger>
                                <Trigger Property="IsFocused" Value="True">
                                    <Setter Property="Background" Value="Transparent"></Setter>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </DataGrid.RowStyle>

                    <DataGrid.Columns>
                        <DataGridTextColumn Header="ID" Binding="{Binding ID}" Width="40" />
                        <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="MESSAGE" Binding="{Binding Message}" Width="1*" />
                        <DataGridTextColumn Header="TIME" Binding="{Binding LastUpdated}" Width="1*" />
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
            <Grid Grid.Row="1" Grid.Column="0"  Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}">
                <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80" IsActive="{Binding IsRunning}"></mahapps:ProgressRing>
                    <TextBlock Text="Loading..." HorizontalAlignment="Center" FontSize="20" FontStyle="Italic" VerticalAlignment="Center" Margin="0 20 0 0"></TextBlock>
                </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">
                <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="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>
                                    </Trigger>
                                    <Trigger Property="IsFocused" Value="True">
                                        <Setter Property="Background" Value="Transparent"></Setter>
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Background" Value="Transparent"></Setter>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </TreeView.ItemContainerStyle>
                        <TreeView.Resources>
                            <HierarchicalDataTemplate DataType="{x:Type diff:ActionLogDifference}" ItemsSource="{Binding Children}">
                                <TextBlock Text="{Binding Name}" Margin="5 0 0 0"  ToolTip="{Binding}" />
                            </HierarchicalDataTemplate>

                            <DataTemplate DataType="{x:Type diff:ActionLogDifferenceValue}">
                                <TextBlock Margin="5 0 0 0" ToolTip="{Binding}">
                                        <Run Text="{Binding Name}"/>
                                        <Run>: </Run>
                                        <Run Text="{Binding Before,Mode=OneWay}" Foreground="{StaticResource DimGrayBrush}"/>
                                        <Run> | </Run>
                                        <Run Text="{Binding After,Mode=OneWay}" Foreground="{StaticResource RedBrush100}"/>
                                </TextBlock>
                            </DataTemplate>
                        </TreeView.Resources>
                    </TreeView>

                </DockPanel>
            </Border>

        </Grid>
    </Grid>
</UserControl>