-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
205 lines (191 loc) · 12.1 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<hc:Window x:Class="MFATools.Views.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:hc="https://handyorg.github.io/handycontrol"
xmlns:controls="clr-namespace:MFATools.Controls"
xmlns:properties="clr-namespace:MFATools.Styles.Properties"
xmlns:viewModels="clr-namespace:MFATools.ViewModels"
xmlns:dd="urn:gong-wpf-dragdrop"
xmlns:converters="clr-namespace:MFATools.Utils.Converters" x:Name="home"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
xmlns:engine="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
xmlns:utils="clr-namespace:MFATools.Utils"
engine:ResxLocalizationProvider.DefaultAssembly="MFATools"
engine:ResxLocalizationProvider.DefaultDictionary="Strings"
mc:Ignorable="d"
Title="{lex:Loc AppTitle}" Height="520" Width="800" MinWidth="410" MinHeight="205"
ShowTitle="False" Icon="../logo.ico" WindowStartupLocation="CenterScreen"
NonClientAreaBackground="{DynamicResource MainContentBackgroundBrush}"
Background="{DynamicResource SecundaryBackgroundColor}"
WindowState="Normal">
<hc:Window.DataContext>
<viewModels:MainViewModel />
</hc:Window.DataContext>
<hc:Window.Resources>
<converters:SubtractConverter x:Key="SubtractConverter" />
<converters:CustomIsEnabledConverter x:Key="CustomIsEnabledConverter" />
<DataTemplate x:Key="DeviceInfoTemplate">
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} ({1})">
<Binding Path="Name" />
<Binding Path="AdbSerial" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
<!-- DataTemplate for WindowInfo -->
<DataTemplate x:Key="WindowInfoTemplate">
<TextBlock Text="{Binding Name}" />
</DataTemplate>
<!-- DataTemplateSelector -->
<utils:DeviceWindowTemplateSelector x:Key="DeviceWindowTemplateSelector"
DeviceInfoTemplate="{StaticResource DeviceInfoTemplate}"
WindowInfoTemplate="{StaticResource WindowInfoTemplate}" />
</hc:Window.Resources>
<hc:Window.NonClientAreaContent>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"
HorizontalAlignment="Left" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Margin="6 0 4 0" Text="{lex:Loc AppTitle}"
IsHitTestVisible="False"
Foreground="{DynamicResource PrimaryTextBrush}">
</TextBlock>
<TextBlock VerticalAlignment="Center" Foreground="{StaticResource GrayColor1}" IsHitTestVisible="False"
Margin="2 0 4 0" x:Name="version" Text="Debug">
</TextBlock>
</StackPanel>
<controls:PinButton Grid.Column="1" x:Name="btnPin" Padding="0 -2 0 0" Width="42"
Content="📌" CheckedChanged="ToggleWindowTopMost">
</controls:PinButton>
</Grid>
</hc:Window.NonClientAreaContent>
<Grid>
<Grid Grid.Column="0">
<Grid Grid.Row="1" Grid.Column="0" Margin="5 0 5 5">
<Grid.RowDefinitions>
<RowDefinition Height="36" />
<RowDefinition />
</Grid.RowDefinitions>
<hc:SimpleStackPanel Orientation="Horizontal" Margin="15,2,10,0" Height="30">
<TabControl TabStripPlacement="Top" Background="Transparent"
SelectionChanged="TabControl_OnSelectionChanged" IsEnabled="{Binding Idle}"
BorderThickness="0" x:Name="TabControl"
Style="{StaticResource TabControlCapsuleSolid}">
<TabItem Header="{lex:Loc TabADB}" x:Name="adbTab"></TabItem>
<TabItem Header="{lex:Loc TabWin32}" x:Name="win32Tab"></TabItem>
</TabControl>
<ComboBox Width="250" x:Name="deviceComboBox" Margin="4 0 0 0"
IsEnabled="{Binding Idle}"
ItemTemplateSelector="{StaticResource DeviceWindowTemplateSelector}"
SelectionChanged="DeviceComboBox_OnSelectionChanged" />
<Button ToolTip="{lex:Loc TooltipRefresh}" Width="20" Height="20" Margin="6 0 2 0"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="Refresh" IsEnabled="{Binding Idle}"
Padding="0" hc:IconElement.Width="14"
hc:IconElement.Geometry="{StaticResource clear}" />
<Button ToolTip="{lex:Loc Custom}" x:Name="btnCustom" Width="20" Height="20" Margin="2 0 2 0"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="CustomAdb" IsEnabled="{Binding Idle}"
Padding="0" hc:IconElement.Width="14"
hc:IconElement.Geometry="{StaticResource CustomGeometry}" />
<Button ToolTip="{lex:Loc TooltipRefresh}" Width="20" Height="20" Margin="6 0 2 0"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="EditSetting" IsEnabled="{Binding Idle}"
Padding="0" hc:IconElement.Width="18"
hc:IconElement.Geometry="{StaticResource SettingsRegular}" />
</hc:SimpleStackPanel>
<Grid Grid.Row="1" ClipToBounds="False" Margin="15 0 15 0">
<Grid.RowDefinitions>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="15"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0" VerticalAlignment="Top"
Margin="0,5,10,4">
<TextBlock VerticalAlignment="Center" Margin="5 0 0 0" Text="工具:"
Foreground="{StaticResource GrayColor4}">
</TextBlock>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
<Button ToolTip="{lex:Loc Copy}" Width="15"
Height="15" Visibility="Collapsed"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="Copy"
Padding="0" hc:IconElement.Width="12" Margin="2 0 2 0"
hc:IconElement.Height="13"
hc:IconElement.Geometry="{StaticResource copy}" />
<Button ToolTip="{lex:Loc EditTaskDialog_RecognitionText_Tooltip}" Width="15"
Height="15"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="RecognitionText"
Padding="0" hc:IconElement.Width="12" Margin="2 0 2 0"
hc:IconElement.Height="12"
hc:IconElement.Geometry="{StaticResource RecognitionTextGeometry}" />
<Button ToolTip="{lex:Loc EditTaskDialog_ColorExtraction_Tooltip}" Width="15"
Height="15"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="ColorExtraction"
Padding="0" Margin="2 0 2 0" hc:IconElement.Width="12"
hc:IconElement.Height="12"
hc:IconElement.Geometry="{StaticResource ColorExtractionGeometry}" />
<Button ToolTip="{lex:Loc EditTaskDialog_Swipe_Tooltip}" Width="15" Height="15"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="Swipe"
Padding="0" Margin="2 0 2 0" hc:IconElement.Width="12"
hc:IconElement.Height="12"
hc:IconElement.Geometry="{StaticResource SwipeGeometry}" />
<Button ToolTip="{lex:Loc EditTaskDialog_Screenshot_Tooltip}" Width="15" Height="15"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="Screenshot"
Padding="0" Margin="2 0 2 0" hc:IconElement.Width="12"
hc:IconElement.Height="12"
hc:IconElement.Geometry="{StaticResource ImageGeometry}" />
<Button ToolTip="{lex:Loc EditTaskDialog_SelectionRegion_Tooltip}" Width="15"
Height="15"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="SelectionRegion"
Padding="0" Margin="2 0 2 0" hc:IconElement.Width="12"
hc:IconElement.Height="12"
hc:IconElement.Geometry="{StaticResource SelectionRegionGeometry}" />
<Button ToolTip="{lex:Loc EditTaskDialog_ClearAttribute_Tooltip}" Width="15"
Height="15"
Style="{StaticResource textBoxButton}"
Foreground="{DynamicResource GrayColor4}"
Click="ClearLog"
Padding="0" Margin="2 0 2 0" hc:IconElement.Width="12"
hc:IconElement.Height="12"
hc:IconElement.Geometry="{StaticResource ClearGeometry}" />
</StackPanel>
</Grid>
<Border Grid.Row="1" Background="White" CornerRadius="8" Margin="0 4 4 0" Padding="4">
<ScrollViewer>
<hc:TagContainer Padding="5" BorderBrush="Transparent" x:Name="TagContainer">
</hc:TagContainer>
</ScrollViewer>
</Border>
</Grid>
</Grid>
</Grid>
<ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0,40,0, 0">
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,0,10,10" x:Name="stackPanel"
Background="Transparent" />
</ScrollViewer>
</Grid>
</hc:Window>