/
QueryView.xaml
88 lines (82 loc) · 5.21 KB
/
QueryView.xaml
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
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fsxaml="http://github.com/fsprojects/FsXaml"
xmlns:validation="clr-namespace:UI.Validation;assembly=UI">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ComboBox Grid.Column="0" Grid.Row="0" VerticalAlignment="Center"
ItemsSource="{Binding Model.LogStores}"
SelectedItem="{Binding Model.SelectedLogStore, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="name"/>
<TextBox Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Padding="2"
Text="{Binding Model.Host, UpdateSourceTrigger=PropertyChanged}"/>
<Label Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" Padding="2"
Content="{Binding Model.SelectedLogStore.channel}"/>
<TextBox Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Padding="2"
Text="{Binding Model.Channel, UpdateSourceTrigger=PropertyChanged}"/>
<ComboBox Name="TargetType" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center"
SelectedValue="{Binding Model.TargetType}"
ItemsSource="{Binding Model.TargetTypes}"/>
<StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal">
<ContentControl>
<ContentControl.Resources>
<ControlTemplate x:Key="DateControl" TargetType="{x:Type ContentControl}">
<TextBox MinWidth="125" TextAlignment="Left" VerticalAlignment="Center" Padding="2">
<TextBox.Text>
<Binding Path="Model.TargetDate" UpdateSourceTrigger="PropertyChanged" StringFormat="yyyy-MM-dd HH:mm:ss">
<Binding.ValidationRules>
<validation:DateTimeValidationRule/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</ControlTemplate>
<ControlTemplate x:Key="TextControl" TargetType="{x:Type ContentControl}">
<TextBox MinWidth="125" TextAlignment="Left" VerticalAlignment="Center" Padding="2"
Text="{Binding Model.TargetText}"/>
</ControlTemplate>
<ControlTemplate x:Key="NumberControl" TargetType="{x:Type ContentControl}">
<TextBox MinWidth="125" TextAlignment="Left" VerticalAlignment="Center" Padding="2"
Text="{Binding Model.TargetNumber}"/>
</ControlTemplate>
</ContentControl.Resources>
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=TargetType, Path=SelectedIndex}" Value="0">
<Setter Property="Template" Value="{DynamicResource DateControl}"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=TargetType, Path=SelectedIndex}" Value="1">
<Setter Property="Template" Value="{DynamicResource TextControl}"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=TargetType, Path=SelectedIndex}" Value="2">
<Setter Property="Template" Value="{DynamicResource NumberControl}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
<Label> increasing at JsonPath: </Label>
<TextBox MinWidth="100" VerticalAlignment="Center" Padding="2"
Text="{Binding Model.TargetPath, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<Label Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" Padding="2">Scan Range <=</Label>
<StackPanel Grid.Column="1" Grid.Row="3" Orientation="Horizontal">
<TextBox MinWidth="25" VerticalAlignment="Center" Padding="2"
Text="{Binding Model.StartScanAt, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<Button Grid.Column="0" Grid.Row="4" VerticalAlignment="Bottom" Margin="0 0 5 0"
Command="{Binding Connect}">Query</Button>
<TextBlock Grid.Column="1" Grid.Row="4" VerticalAlignment="Bottom" Margin="0 0 0 5" Text="{Binding Model.Status}"/>
</Grid>
</UserControl>