-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml
103 lines (103 loc) · 6.29 KB
/
MainWindow.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<Window x:Class="KafkaSniffer.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:local="clr-namespace:KafkaSniffer"
mc:Ignorable="d"
Title="KafkaSniffer" Height="600" Width="940" MinHeight="540" MinWidth="940" Loaded="WindowLoaded">
<Window.DataContext>
<local:Vm x:Name="Vm"/>
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="*" />
<RowDefinition Height="240" />
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="Default Broker">
<StackPanel Orientation="Horizontal">
<Label Content="Endpoint"/>
<TextBox Width="240" Text="{Binding BrokerInfo.Endpoint}" IsEnabled="{Binding BrokerInfo.NotSetted}" />
<Button Click="ModifyOffset">Modify Partition Offset</Button>
<CheckBox IsChecked="{Binding BrokerInfo.Debug}">Debug</CheckBox>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="1" Header="Consumer List">
<TabControl ItemsSource="{Binding ConsumerList, Mode=OneWay}" Name="ConsumerList">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Topic, Mode=OneWay}" ToolTip="{Binding Topic, Mode=OneWay}" MinWidth="40" MaxWidth="120"/>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate DataType="{x:Type local:Consumer}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Label>Endpoint</Label>
<TextBox Text="{Binding Path=Endpoint}" IsEnabled="{Binding Path=NotSubscribe}" />
<Label>Topic</Label>
<TextBox Text="{Binding Path=Topic, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=NotSubscribe}" />
<Label>Group ID</Label>
<TextBox Text="{Binding Path=GroupId}" IsEnabled="{Binding Path=NotSubscribe}" />
<Label>Offset Type</Label>
<ComboBox SelectedItem="{Binding Path=CurOffsetType}" IsEnabled="{Binding Path=NotSubscribe}" ItemsSource="{Binding Path=OffsetTypeList}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Label>Count</Label>
<TextBox Text="{Binding Path=Count}" IsEnabled="{Binding Path=NotSubscribe}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,5,0,0" HorizontalAlignment="Right" Height="25">
<Button Click="Subscribe" IsEnabled="{Binding Path=NotSubscribe}">Subscribe</Button>
<Button Click="ClearMessageLog">Clear</Button>
<Button Click="CloseConsumer">Close</Button>
</StackPanel>
<TextBox Style="{DynamicResource MultiLine}" Grid.Row="2" Margin="10" IsReadOnly="True" Text="{Binding Path=MessageLog, Mode=OneWay}"/>
<CheckBox IsChecked="{Binding Path=IsLogToFile}" Grid.Row="3" HorizontalAlignment="Right" Click="LogFile">Log to file</CheckBox>
</Grid>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</GroupBox>
<GroupBox Grid.Row="2" Header="Producer List">
<TabControl ItemsSource="{Binding ProducerList, Mode=OneWay}" x:Name="ProducerList">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Topic}" ToolTip="{Binding Topic}" MinWidth="40" MaxWidth="120"/>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate DataType="{x:Type local:Producer}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Label>Endpoint</Label>
<TextBox Width="160" Text="{Binding Path=Endpoint}" IsEnabled="{Binding Path=NotInit}" />
<Label>Topic</Label>
<TextBox Text="{Binding Path=Topic, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=NotInit}" />
<Label>Key</Label>
<TextBox Text="{Binding Path=Key}" />
<Button Click="ProduceMessage">Send</Button>
<Button Click="CloseProducer">Close</Button>
</StackPanel>
<TextBox Style="{DynamicResource MultiLine}" Grid.Row="1" Margin="10" Text="{Binding Path=Message}"/>
</Grid>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</GroupBox>
</Grid>
</Window>