aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Views/ResultsView.xaml
blob: 569b77820aff2312a79c166a6c3237211f427c55 (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
<UserControl x:Class="Tango.FSE.Procedures.Views.ResultsView"
             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:global="clr-namespace:Tango.FSE.Procedures"
             xmlns:vm="clr-namespace:Tango.FSE.Procedures.ViewModels"
             xmlns:graphs="clr-namespace:Tango.FSE.Common.Graphs;assembly=Tango.FSE.Common"
             xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:converters="clr-namespace:Tango.FSE.Procedures.Converters"
             xmlns:local="clr-namespace:Tango.FSE.Procedures.Views"
             mc:Ignorable="d" 
             d:DesignHeight="720" d:DesignWidth="1280" d:DesignStyle="{StaticResource FSE_User_Control_Designer}" d:DataContext="{d:DesignInstance Type=vm:ResultsViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}">

    <UserControl.Resources>
        <converters:BitmapToBitmapSourceConverter x:Key="BitmapToBitmapSourceConverter" />
    </UserControl.Resources>

    <Grid>
        <ItemsControl ItemsSource="{Binding Results}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <DockPanel Margin="10">
                        <material:PackIcon HorizontalAlignment="Center" VerticalAlignment="Center" Width="42" Height="42">
                            <material:PackIcon.Style>
                                <Style TargetType="material:PackIcon">
                                    <Setter Property="Kind" Value="Check"></Setter>
                                    <Setter Property="Foreground" Value="{StaticResource FSE_SuccessBrush}"></Setter>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Type}" Value="Warning">
                                            <Setter Property="Kind" Value="Alert"></Setter>
                                            <Setter Property="Foreground" Value="{StaticResource FSE_WarningBrush}"></Setter>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding Type}" Value="Failed">
                                            <Setter Property="Kind" Value="Alert"></Setter>
                                            <Setter Property="Foreground" Value="{StaticResource FSE_ErrorBrush}"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </material:PackIcon.Style>
                        </material:PackIcon>
                        <StackPanel Margin="15 0 0 0" VerticalAlignment="Center">
                            <TextBlock Text="{Binding Name}" ></TextBlock>
                            <Grid Margin="0 2 0 0" Visibility="{Binding IsBitmap,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
                                <TextBlock Visibility="{Binding IsValueArray,Converter={StaticResource BooleanToVisibilityInverseConverter}}" FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding Value}"></TextBlock>

                                <StackPanel Visibility="{Binding IsValueArray,Converter={StaticResource BooleanToVisibilityConverter}}">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">
                                                                    <Run>This procedure result contains</Run>
                                                                    <Run Text="{Binding Value.Count,Mode=OneWay}"></Run>
                                                                    <Run Text="Values."></Run>
                                        </TextBlock>
                                        <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisplayResultGridCommand}" CommandParameter="{Binding}" Height="22" FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_PrimaryAccentBrush}" Background="Transparent" BorderBrush="Transparent" Margin="0 -4 0 0">(Grid View)</Button>
                                        <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ExportResultGridCommand}" CommandParameter="{Binding}" Height="22" FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_PrimaryAccentBrush}" Background="Transparent" Padding="0" BorderBrush="Transparent" Margin="0 -4 0 0">(Export To CSV)</Button>
                                    </StackPanel>

                                    <StackPanel Visibility="{Binding IsGraph,Converter={StaticResource BooleanToVisibilityConverter}}">
                                        <Border Margin="0 10 0 0"  Padding="10" Background="#303030" CornerRadius="5">
                                            <graphs:RealTimeGraph Foreground="{StaticResource FSE_PrimaryForegroundBrush}" GridLinesBrush="#383838" BorderBrush="Transparent" Width="750" Height="250" Loaded="RealTimeGraph_Loaded" Style="{StaticResource FSE_RealTimeGraph_Result}" />
                                        </Border>
                                    </StackPanel>
                                </StackPanel>
                            </Grid>

                            <Grid Margin="0 2 0 0" Visibility="{Binding IsBitmap,Converter={StaticResource BooleanToVisibilityConverter}}">
                                <Image HorizontalAlignment="Left" Source="{Binding Value,Converter={StaticResource BitmapToBitmapSourceConverter}}" Stretch="None" />
                            </Grid>
                        </StackPanel>
                    </DockPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>