aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml
blob: e56ae6639e0e0758bf47ff4c6aa131ce93f8da1c (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
<Window x:Class="Tango.DispenserAnalyzer.UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:oxy="http://oxyplot.org/wpf"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
        xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
        xmlns:local="clr-namespace:Tango.DispenserAnalyzer.UI"
        xmlns:vm ="clr-namespace:Tango.DispenserAnalyzer.UI.ViewModels"
        mc:Ignorable="d"
        Title="{Binding WindowTitle, RelativeSource={RelativeSource Mode=Self}}" Height="1000" Width="860" WindowStartupLocation="CenterScreen" WindowStyle="SingleBorderWindow" ResizeMode="CanResize" Foreground="#202020" 
        d:DataContext="{d:DesignInstance Type=vm:MainWindowVM, IsDesignTimeCreatable=False}">
    <Window.Resources>
        <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
        <converters:IsNullToVisibilityConverter x:Key="IsNullToVisibilityConverter"/>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" />
        <Style TargetType="ScrollBar">
            <Setter Property="Background" Value="#B9E7E9E9"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="80"/>
            <RowDefinition Height="60"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="40*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid  Grid.Row="0" Margin="10 20 10 20">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBox x:Name="tbPath" BorderThickness="1" FontSize="16" VerticalContentAlignment="Center" IsReadOnly="False" Grid.Column="0" Margin="0 0 20 0" Text="{Binding OpenFilePath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" PreviewDrop="TextBlock_PreviewDrop" PreviewDragOver="TextBox_PreviewDragOver" BorderBrush="Silver" Padding="5 0 0 0 "></TextBox>
            <Button  Grid.Column="1"  Command="{Binding OpenCSVFileCommand}">Browse</Button>
        </Grid>
        <Grid Grid.Row="1"  HorizontalAlignment="Stretch" Margin="10 0 20 20">
        <Button   Command="{Binding GenerateCommand}" Content="{Binding ButtonName}" Margin="0 0 30 0"></Button>
            <Button Command="{Binding OpenSettingWndCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Width="20" Height="20" Margin="0 0 0 0" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Open Setting Window">
                <materialDesign:PackIcon Kind="Settings" Width="16" Height="16" VerticalAlignment="Center"></materialDesign:PackIcon>
            </Button>
        </Grid>
        <Grid Grid.Row="2">
            <Border BorderBrush="Silver" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10">
                <Expander Header="{Binding TestName}" IsExpanded="True">
                <!--<lvc:CartesianChart  LegendLocation="Bottom" DisableAnimations="True" DataTooltip="{x:Null}" Hoverable="False" >
                        <lvc:CartesianChart.Series>
                            <lvc:LineSeries Values="{Binding Values}" PointGeometry="{x:Null}" Title="{Binding TestName}"/>
                        </lvc:CartesianChart.Series>
                        <lvc:CartesianChart.AxisX>
                            <lvc:Axis Title="TIME" Foreground="Silver"   Labels="{Binding Labels}">
                                <lvc:Axis.Separator>
                                    <lvc:Separator Stroke="#A5A5A5" Step="{Binding XStep}"/>
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisX>
                        <lvc:CartesianChart.AxisY>
                            <lvc:Axis Title="PRESSURE" LabelFormatter="{Binding YFormatter}"  MinValue="{Binding From, Mode=TwoWay}" MaxValue="{Binding To, Mode=TwoWay}" Foreground="Silver" FontSize="16" >
                                <lvc:Axis.Separator>
                                    <lvc:Separator Stroke="#B0B0B0" />
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisY>
                    </lvc:CartesianChart>-->
                <oxy:Plot Title="{Binding TestName}" x:Name="PressurePlot" Height="300">
                    <oxy:Plot.Series >
                        <oxy:LineSeries ItemsSource="{Binding Points}"  Color="#73B6EC"  MarkerType="None"/>
                    </oxy:Plot.Series>
                        <oxy:Plot.Axes>
                            <oxy:LinearAxis Position="Bottom"  Title = "Time [msec]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True"/>
                            <oxy:LinearAxis Position="Left"  Title = "Pressure [mbar]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding From}" Maximum="{Binding To}"/>
                        </oxy:Plot.Axes>
                    </oxy:Plot>
                </Expander>
            </Border>
        </Grid>

        <Border Visibility="Visible" BorderThickness="1" BorderBrush="Silver" CornerRadius="5" Margin="10" Grid.Row="3">
            <DockPanel  VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                <Label  Height="30" Content="RESULT" Background="LightSkyBlue" Grid.Row="0" DockPanel.Dock="Top" />

                <ScrollViewer VerticalScrollBarVisibility="Auto"  Visibility="Visible"  Focusable="True" Foreground="Black"  Margin="5" 
                              Style="{StaticResource {x:Type ScrollViewer}}">
                    <ScrollViewer.Resources>
                        <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">15</sys:Double>
                    </ScrollViewer.Resources>
                    <ItemsControl x:Name="resultItems" ItemsSource="{Binding AnalyzerResults}" Margin="0 0 10 10 ">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border   HorizontalAlignment="Stretch" Margin="10 10 0 0" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="Silver">
                                    <Grid  HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="1*"/>
                                            <ColumnDefinition Width="100"/>
                                        </Grid.ColumnDefinitions>
                                        <StackPanel  Orientation="Vertical" Margin="5" Grid.Column="0">
                                            <ItemsControl   ItemsSource="{Binding Properties}" >
                                                <ItemsControl.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Vertical" Margin="5">
                                                            <TextBlock Margin="5 0 0 0" FontSize="12"><Run Text="{Binding Name}"></Run> <Run Text=" : "></Run><Run Text="{Binding Value,StringFormat=0}"></Run></TextBlock>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ItemsControl.ItemTemplate>
                                            </ItemsControl>
                                            <Border x:Name="PlotBorder" BorderBrush="Silver" Padding="2" BorderThickness="1" CornerRadius="5" Margin="10" Visibility="{Binding IsShowPlotResult, Converter={StaticResource BooleanToVisibilityConverter}}"  MinHeight="300">
                                                <StackPanel  Orientation="Vertical" x:Name="PlotStackPanel">
                                                    <oxy:Plot Title="{Binding RangeToCountChart.Title}" x:Name="RangeToCountPlot"  LegendPlacement="Outside" LegendPosition="RightTop" LegendOrientation="Vertical" ClipToBounds="True" Loaded="RangeToCountPlot_Loaded" MinWidth="220" MinHeight="300">
                                                        <oxy:Plot.Series >
                                                            <oxy:ColumnSeries ItemsSource="{Binding RangeToCountChart.Points}"  Color="#73B6EC"  StrokeThickness="1" FillColor="#73B6EC" ValueField="Y" LabelFormatString="{}{0}" LabelPlacement="Base" />
                                                        </oxy:Plot.Series>
                                                        <oxy:Plot.Axes>
                                                            <oxy:CategoryAxis  Position="Bottom"  Title = "Max-min \ range [mbar]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot"  ItemsSource="{Binding RangeToCountChart.Points}" LabelField="X" IsZoomEnabled="False"/>
                                                            <oxy:LinearAxis Position="Left"  Title = "Count" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot"  Minimum="0" MinimumPadding="5" AbsoluteMinimum="0" IsZoomEnabled="False"/>
                                                        </oxy:Plot.Axes>
                                                    </oxy:Plot>
                                                </StackPanel>
                                            </Border>
                                            <Border x:Name="RangeToTimeBorder" BorderBrush="Silver" Padding="2" BorderThickness="1" CornerRadius="5" Margin="10" Visibility="{Binding IsShowPlotResult, Converter={StaticResource BooleanToVisibilityConverter}}"  MinHeight="300">
                                                <StackPanel  Orientation="Vertical" x:Name="RangeToTimeStackPanel">
                                                    <oxy:Plot Title="{Binding RangeToTimeChart.Title}" x:Name="RangeToTimePlot"  LegendPlacement="Outside" LegendPosition="RightTop" LegendOrientation="Vertical" ClipToBounds="True"  MinWidth="220" MinHeight="300">
                                                        <oxy:Plot.Series >
                                                            <oxy:LineSeries ItemsSource="{Binding RangeToTimeChart.Points}"  Color="#73B6EC"  StrokeThickness="1" MarkerFill="SteelBlue" />
                                                        </oxy:Plot.Series>
                                                        <oxy:Plot.Axes>
                                                            <oxy:LinearAxis Position="Bottom"  Title = "Location" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True"/>
                                                            <oxy:LinearAxis Position="Left"  Title = "Max-min \ range [mbar]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding RangeToTimeChart.From}" Maximum="{Binding RangeToTimeChart.To}"/>
                                                        </oxy:Plot.Axes>
                                                    </oxy:Plot>
                                                </StackPanel>
                                            </Border>
                                        </StackPanel>
                                        <Border Grid.Column="1"  HorizontalAlignment="Center" Margin="10 0 0 0" VerticalAlignment="Center">
                                            <materialDesign:PackIcon  Kind="{Binding Result, Converter= {StaticResource EnumToDescriptionConverter}}" Width="60" Height="60"  HorizontalContentAlignment="Center" VerticalAlignment="Center" >
                                                <materialDesign:PackIcon.Style>
                                                    <Style TargetType="materialDesign:PackIcon">
                                                        <Setter Property="Foreground" Value="Orange"></Setter>
                                                        <Style.Triggers>
                                                            <Trigger Property="Kind" Value="Check">
                                                                <Setter Property="Foreground" Value="green"></Setter>
                                                            </Trigger>
                                                            <Trigger Property="Kind" Value="CloseCircle">
                                                                <Setter Property="Foreground" Value="Red"></Setter>
                                                            </Trigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </materialDesign:PackIcon.Style>
                                            </materialDesign:PackIcon>
                                        </Border>
                                    </Grid>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>

            </DockPanel>
        </Border>


        <Grid Grid.Row="1" Grid.RowSpan="3" 
              HorizontalAlignment="Stretch"  
              VerticalAlignment="Stretch" 
              Visibility="{Binding IsRunning, Converter={StaticResource BooleanToVisibilityConverter}}" 
              Background="#8BFFFFFF">
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                <TextBlock Text="Loading..." FontStyle="Italic"  FontSize="30" VerticalAlignment="Center"></TextBlock>
            </StackPanel>
        </Grid>
    </Grid>
</Window>