MainWindow.xaml
5.59 KB
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
<Window
x:Class="HHECS.DAQClient.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:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:HHECS.DAQClient"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="clr-namespace:HHECS.DAQClient.Common"
xmlns:viewmodel="clr-namespace:HHECS.DAQClient.ViewModel"
Title="IOTCloud 数据采集"
Width="1024"
Height="600"
MinWidth="800"
MinHeight="450"
d:DataContext="{d:DesignInstance Type=viewmodel:MainVM}"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
mc:Ignorable="d">
<Window.Resources>
<DataTemplate DataType="{x:Type model:LogModel}">
<TextBlock Foreground="{Binding Path=ForeColor}" TextWrapping="Wrap">
<TextBlock.Text>
<MultiBinding StringFormat="{}[{0:yyyy/MM/dd HH:mm:ss}]{1}">
<Binding Path="CreateTime" />
<Binding Path="Messages" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="18" />
</Grid.RowDefinitions>
<ToolBar
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Stretch">
<hc:UniformSpacingPanel Spacing="10">
<Button
x:Name="Btn_Start"
Command="{Binding StartCommand}"
Content="启动"
IsEnabled="{Binding BtnStartEnabled}"
Style="{StaticResource ButtonSuccess}" />
<Button
x:Name="Btn_Stop"
Command="{Binding StopCommand}"
Content="停止"
IsEnabled="{Binding BtnStopEnabled}"
Style="{StaticResource ButtonWarning}" />
<ToggleButton
HorizontalAlignment="Center"
hc:ToggleButtonAttach.ShowLabel="True"
Content="自动上传"
IsChecked="{Binding AutoCommit}"
Style="{StaticResource ToggleButtonSwitch}" />
<ToggleButton
HorizontalAlignment="Center"
hc:ToggleButtonAttach.ShowLabel="True"
Content="节流模式"
IsChecked="{Binding DataCompression}"
Style="{StaticResource ToggleButtonSwitch}" />
<TextBlock Height="16" VerticalAlignment="Center">
<Run Text="队列缓存:" />
<Run Text="{Binding QueueCount}" />
</TextBlock>
</hc:UniformSpacingPanel>
</ToolBar>
<TabControl
Grid.Row="1"
Grid.Column="0"
Style="{StaticResource TabControlBaseStyle}">
<TabItem Header="日志">
<ItemsControl ItemsSource="{Binding LogModels}">
<ItemsControl.Template>
<ControlTemplate>
<VirtualizingStackPanel x:Name="ScrollViewer">
<ItemsPresenter />
</VirtualizingStackPanel>
</ControlTemplate>
</ItemsControl.Template>
</ItemsControl>
</TabItem>
<TabItem Header="通讯配置">
<Frame Content="{Binding CommunicationPage}" NavigationUIVisibility="Hidden" />
</TabItem>
<TabItem Header="设备信息">
<Frame Content="{Binding EquipmentPage}" NavigationUIVisibility="Hidden" />
</TabItem>
<TabItem Header="待推送数据">
<Frame Content="{Binding EquipmentDataQueuePage}" NavigationUIVisibility="Hidden" />
</TabItem>
</TabControl>
<StackPanel
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{StaticResource DarkDefaultBrush}">
<TextBlock
Padding="0,1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{StaticResource SecondaryTextBrush}"
Text="Copyright © 2024 长沙华恒机器人系统有限公司" />
</StackPanel>
<hc:NotifyIcon
x:Name="NotifyIconContextContent"
Icon="/favicon.ico"
Text="数据采集"
Visibility="Visible">
<hc:NotifyIcon.ContextMenu>
<ContextMenu Width="140">
<MenuItem Command="hc:ControlCommands.PushMainWindow2Top" Header="打开 数据采集" />
<Separator />
<MenuItem Command="hc:ControlCommands.ShutdownApp" Header="退出" />
</ContextMenu>
</hc:NotifyIcon.ContextMenu>
<hc:Interaction.Triggers>
<hc:EventTrigger EventName="Click">
<hc:EventToCommand Command="hc:ControlCommands.PushMainWindow2Top" />
</hc:EventTrigger>
</hc:Interaction.Triggers>
</hc:NotifyIcon>
</Grid>
</Window>