Skip to content

Commit 52eebcb

Browse files
committed
UI: 使用wpf-ui
1 parent f27aeb2 commit 52eebcb

File tree

4 files changed

+258
-75
lines changed

4 files changed

+258
-75
lines changed
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
<Application x:Class="GeneralUpdate.Packet.App"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:local="clr-namespace:GeneralUpdate.Packet"
5-
StartupUri="MainWindow.xaml">
1+
<Application
2+
x:Class="GeneralUpdate.Packet.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="clr-namespace:GeneralUpdate.Packet"
6+
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
7+
StartupUri="MainWindow.xaml">
68
<Application.Resources>
7-
9+
<ResourceDictionary>
10+
<ResourceDictionary.MergedDictionaries>
11+
<ui:ThemesDictionary Theme="Light" />
12+
<ui:ControlsDictionary />
13+
</ResourceDictionary.MergedDictionaries>
14+
</ResourceDictionary>
815
</Application.Resources>
916
</Application>

src/WPF/GeneralUpdate.Packet/GeneralUpdate.Packet.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
1818
<PackageReference Include="GeneralUpdate.Differential" Version="1.4.3" />
1919
<PackageReference Include="GeneralUpdate.Zip" Version="2.3.2" />
20-
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
2120
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
2221
<PackageReference Include="WindowsAPICodePack" Version="7.0.4" />
22+
<PackageReference Include="WPF-UI" Version="3.0.4" />
2323
</ItemGroup>
2424

2525
<ItemGroup>

src/WPF/GeneralUpdate.Packet/MainWindow.xaml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
1-
<Window x:Class="GeneralUpdate.Packet.MainWindow"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:local="clr-namespace:GeneralUpdate.Packet"
7-
mc:Ignorable="d"
8-
Title="GeneralUpdate.Packet" Height="640" Width="900">
1+
<Window
2+
x:Class="GeneralUpdate.Packet.MainWindow"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:GeneralUpdate.Packet"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
9+
Title="GeneralUpdate.Packet"
10+
Width="900"
11+
Height="640"
12+
mc:Ignorable="d">
913
<Grid>
1014
<Grid.RowDefinitions>
11-
<RowDefinition Height="100"></RowDefinition>
12-
<RowDefinition></RowDefinition>
15+
<RowDefinition Height="100" />
16+
<RowDefinition />
1317
</Grid.RowDefinitions>
14-
<Image Source=".\Resource\GeneralUpdate_h.png"></Image>
15-
<TabControl Grid.Row="1" ItemsSource="{Binding Modules}" SelectedItem="{Binding CurrentModule}" TabStripPlacement="Left">
18+
<Image Source=".\Resource\GeneralUpdate_h.png" />
19+
<TabControl
20+
Grid.Row="1"
21+
ItemsSource="{Binding Modules}"
22+
SelectedItem="{Binding CurrentModule}"
23+
TabStripPlacement="Bottom">
1624
<TabControl.ItemTemplate>
1725
<DataTemplate>
1826
<TextBlock Text="{Binding Name}" />
1927
</DataTemplate>
2028
</TabControl.ItemTemplate>
2129
<TabControl.ContentTemplate>
2230
<DataTemplate>
23-
<ContentPresenter Width="Auto" Height="Auto" Content="{Binding View}" />
31+
<ContentPresenter
32+
Width="Auto"
33+
Height="Auto"
34+
Content="{Binding View}" />
2435
</DataTemplate>
2536
</TabControl.ContentTemplate>
2637
</TabControl>
Lines changed: 220 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
<UserControl x:Class="GeneralUpdate.Packet.Views.PacketView"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:local="clr-namespace:GeneralUpdate.Packet.Views"
7-
mc:Ignorable="d"
8-
d:DesignHeight="490" d:DesignWidth="800">
1+
<UserControl
2+
x:Class="GeneralUpdate.Packet.Views.PacketView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:GeneralUpdate.Packet.Views"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
d:DesignHeight="490"
9+
d:DesignWidth="800"
10+
mc:Ignorable="d">
911
<Grid>
1012
<Grid.RowDefinitions>
1113
<RowDefinition />
@@ -24,65 +26,228 @@
2426
<RowDefinition />
2527
</Grid.RowDefinitions>
2628
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
27-
<Image Width="100" Height="100" Source="generalupdate_img.png" />
29+
<Image
30+
Width="100"
31+
Height="100"
32+
Source="generalupdate_img.png" />
2833
</StackPanel>
29-
<StackPanel Grid.Row="1" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
30-
<TextBlock VerticalAlignment="Center" Text="Source path :" />
31-
<TextBox Width="400" Height="30" Margin="3,0,3,0" Text="{Binding SourcePath}" VerticalContentAlignment="Center" />
32-
<Button Width="110" Height="30" Content="Pick folder" Command="{Binding SelectFolderCommand}" CommandParameter="Source" />
33-
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center" />
34+
<StackPanel
35+
Grid.Row="1"
36+
Height="40"
37+
HorizontalAlignment="Center"
38+
Orientation="Horizontal">
39+
<TextBlock VerticalAlignment="Center" Text="Source path :" />
40+
<TextBox
41+
Width="400"
42+
Height="30"
43+
Margin="3,0,3,0"
44+
VerticalContentAlignment="Center"
45+
Text="{Binding SourcePath}" />
46+
<Button
47+
Width="110"
48+
Height="30"
49+
Command="{Binding SelectFolderCommand}"
50+
CommandParameter="Source"
51+
Content="Pick folder" />
52+
<TextBlock
53+
VerticalAlignment="Center"
54+
Foreground="Red"
55+
Text="*" />
3456
</StackPanel>
35-
<StackPanel Grid.Row="2" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
36-
<TextBlock VerticalAlignment="Center" Text="Target path :" />
37-
<TextBox Width="400" Height="30" Margin="5,0,3,0" Text="{Binding TargetPath}" VerticalContentAlignment="Center" />
38-
<Button Width="110" Height="30" Content="Pick folder" Command="{Binding SelectFolderCommand}" CommandParameter="Target" />
39-
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center" />
57+
<StackPanel
58+
Grid.Row="2"
59+
Height="40"
60+
HorizontalAlignment="Center"
61+
Orientation="Horizontal">
62+
<TextBlock VerticalAlignment="Center" Text="Target path :" />
63+
<TextBox
64+
Width="400"
65+
Height="30"
66+
Margin="5,0,3,0"
67+
VerticalContentAlignment="Center"
68+
Text="{Binding TargetPath}" />
69+
<Button
70+
Width="110"
71+
Height="30"
72+
Command="{Binding SelectFolderCommand}"
73+
CommandParameter="Target"
74+
Content="Pick folder" />
75+
<TextBlock
76+
VerticalAlignment="Center"
77+
Foreground="Red"
78+
Text="*" />
4079
</StackPanel>
41-
<StackPanel Grid.Row="3" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
42-
<TextBlock VerticalAlignment="Center" Text="Patch path :" />
43-
<TextBox Width="400" Height="30" Margin="9,0,3,0" Text="{Binding PatchPath}" VerticalContentAlignment="Center" />
44-
<Button Width="110" Height="30" Content="Pick folder" Command="{Binding SelectFolderCommand}" CommandParameter="Patch" />
45-
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center" />
80+
<StackPanel
81+
Grid.Row="3"
82+
Height="40"
83+
HorizontalAlignment="Center"
84+
Orientation="Horizontal">
85+
<TextBlock VerticalAlignment="Center" Text="Patch path :" />
86+
<TextBox
87+
Width="400"
88+
Height="30"
89+
Margin="9,0,3,0"
90+
VerticalContentAlignment="Center"
91+
Text="{Binding PatchPath}" />
92+
<Button
93+
Width="110"
94+
Height="30"
95+
Command="{Binding SelectFolderCommand}"
96+
CommandParameter="Patch"
97+
Content="Pick folder" />
98+
<TextBlock
99+
VerticalAlignment="Center"
100+
Foreground="Red"
101+
Text="*" />
46102
</StackPanel>
47-
<StackPanel Margin="0,0,120,0" Grid.Row="4" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
48-
<TextBlock VerticalAlignment="Center" Text="Packet name :" />
49-
<TextBox Width="400" Height="30" Margin="9,0,3,0" Text="{Binding PacketName , Mode=TwoWay}" VerticalContentAlignment="Center" />
50-
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center" />
103+
<StackPanel
104+
Grid.Row="4"
105+
Height="40"
106+
Margin="0,0,120,0"
107+
HorizontalAlignment="Center"
108+
Orientation="Horizontal">
109+
<TextBlock VerticalAlignment="Center" Text="Packet name :" />
110+
<TextBox
111+
Width="400"
112+
Height="30"
113+
Margin="9,0,3,0"
114+
VerticalContentAlignment="Center"
115+
Text="{Binding PacketName, Mode=TwoWay}" />
116+
<TextBlock
117+
VerticalAlignment="Center"
118+
Foreground="Red"
119+
Text="*" />
51120
</StackPanel>
52-
<StackPanel Margin="0,0,85,0" Grid.Row="5" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
53-
<TextBlock VerticalAlignment="Center" Text="Format :" />
54-
<ComboBox Width="400" Height="30" Margin="9,0,3,0" ItemsSource="{Binding Formats}" SelectedItem="{Binding CurrentFormat}" VerticalContentAlignment="Center" />
55-
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center" />
121+
<StackPanel
122+
Grid.Row="5"
123+
Height="40"
124+
Margin="0,0,85,0"
125+
HorizontalAlignment="Center"
126+
Orientation="Horizontal">
127+
<TextBlock VerticalAlignment="Center" Text="Format :" />
128+
<ComboBox
129+
Width="400"
130+
Height="35"
131+
Margin="9,0,3,0"
132+
VerticalContentAlignment="Center"
133+
ItemsSource="{Binding Formats}"
134+
SelectedItem="{Binding CurrentFormat}" />
135+
<TextBlock
136+
VerticalAlignment="Center"
137+
Foreground="Red"
138+
Text="*" />
56139
</StackPanel>
57-
<StackPanel Margin="0,0,100,0" Grid.Row="6" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
58-
<TextBlock VerticalAlignment="Center" Text="Encoding :" />
59-
<ComboBox Width="400" Height="30" Margin="9,0,3,0" SelectedIndex="0" ItemsSource="{Binding Encodings}" SelectedItem="{Binding CurrentEncoding}" VerticalContentAlignment="Center" />
60-
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center" />
140+
<StackPanel
141+
Grid.Row="6"
142+
Height="40"
143+
Margin="0,0,100,0"
144+
HorizontalAlignment="Center"
145+
Orientation="Horizontal">
146+
<TextBlock VerticalAlignment="Center" Text="Encoding :" />
147+
<ComboBox
148+
Width="400"
149+
Height="35"
150+
Margin="9,0,3,0"
151+
VerticalContentAlignment="Center"
152+
ItemsSource="{Binding Encodings}"
153+
SelectedIndex="0"
154+
SelectedItem="{Binding CurrentEncoding}" />
155+
<TextBlock
156+
VerticalAlignment="Center"
157+
Foreground="Red"
158+
Text="*" />
61159
</StackPanel>
62-
<StackPanel Margin="0,0,135,0" Grid.Row="7" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
63-
<TextBlock VerticalAlignment="Center" Text="Client app key :" />
64-
<TextBox Width="400" Height="30" Margin="9,0,3,0" Text="{Binding CurrentClientAppKey}" VerticalContentAlignment="Center" />
160+
<StackPanel
161+
Grid.Row="7"
162+
Height="40"
163+
Margin="0,0,135,0"
164+
HorizontalAlignment="Center"
165+
Orientation="Horizontal">
166+
<TextBlock VerticalAlignment="Center" Text="Client app key :" />
167+
<TextBox
168+
Width="400"
169+
Height="30"
170+
Margin="9,0,3,0"
171+
VerticalContentAlignment="Center"
172+
Text="{Binding CurrentClientAppKey}" />
65173
</StackPanel>
66-
<StackPanel Margin="0,0,115,0" Grid.Row="8" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
67-
<TextBlock VerticalAlignment="Center" Text="Client type :" />
68-
<ComboBox Width="400" Height="32" Margin="9,0,3,0" ItemsSource="{Binding AppTypes}" SelectedItem="{Binding CurrentAppType}" VerticalContentAlignment="Center" />
174+
<StackPanel
175+
Grid.Row="8"
176+
Height="40"
177+
Margin="0,0,115,0"
178+
HorizontalAlignment="Center"
179+
Orientation="Horizontal">
180+
<TextBlock VerticalAlignment="Center" Text="Client type :" />
181+
<ComboBox
182+
Width="400"
183+
Height="32"
184+
Margin="9,0,3,0"
185+
VerticalContentAlignment="Center"
186+
ItemsSource="{Binding AppTypes}"
187+
SelectedItem="{Binding CurrentAppType}" />
69188
</StackPanel>
70-
<StackPanel Margin="0,5,110,5" Grid.Row="9" Orientation="Horizontal" HorizontalAlignment="Center">
71-
<TextBlock VerticalAlignment="Center" Text="Server url :" />
72-
<TextBox Width="400" Height="30" Margin="9,0,3,0" Text="{Binding Url}" VerticalContentAlignment="Center" />
189+
<StackPanel
190+
Grid.Row="9"
191+
Margin="0,5,110,5"
192+
HorizontalAlignment="Center"
193+
Orientation="Horizontal">
194+
<TextBlock VerticalAlignment="Center" Text="Server url :" />
195+
<TextBox
196+
Width="400"
197+
Height="30"
198+
Margin="9,0,3,0"
199+
VerticalContentAlignment="Center"
200+
Text="{Binding Url}" />
73201
</StackPanel>
74-
<StackPanel Margin="0,0,145,0" Grid.Row="10" Orientation="Horizontal" HorizontalAlignment="Center">
75-
<TextBlock VerticalAlignment="Center" Text="Currnet version :" />
76-
<TextBox Width="400" Height="30" Margin="9,0,3,0" Text="{Binding CurrentVersion}" VerticalContentAlignment="Center" />
202+
<StackPanel
203+
Grid.Row="10"
204+
Margin="0,0,145,0"
205+
HorizontalAlignment="Center"
206+
Orientation="Horizontal">
207+
<TextBlock VerticalAlignment="Center" Text="Currnet version :" />
208+
<TextBox
209+
Width="400"
210+
Height="30"
211+
Margin="9,0,3,0"
212+
VerticalContentAlignment="Center"
213+
Text="{Binding CurrentVersion}" />
77214
</StackPanel>
78-
<StackPanel Grid.Row="11" Orientation="Horizontal" Height="40" HorizontalAlignment="Center">
79-
<TextBlock VerticalAlignment="Center" Text="Driver dir :" />
80-
<TextBox Width="400" Height="30" Margin="9,0,3,0" Text="{Binding PatchPath}" VerticalContentAlignment="Center" />
81-
<Button Width="110" Height="30" Content="Pick driver" Command="{Binding SelectFolderCommand}" CommandParameter="Driver" />
215+
<StackPanel
216+
Grid.Row="11"
217+
Height="40"
218+
HorizontalAlignment="Center"
219+
Orientation="Horizontal">
220+
<TextBlock VerticalAlignment="Center" Text="Driver dir :" />
221+
<TextBox
222+
Width="400"
223+
Height="30"
224+
Margin="9,0,3,0"
225+
VerticalContentAlignment="Center"
226+
Text="{Binding PatchPath}" />
227+
<Button
228+
Width="110"
229+
Height="30"
230+
Command="{Binding SelectFolderCommand}"
231+
CommandParameter="Driver"
232+
Content="Pick driver" />
82233
</StackPanel>
83-
<StackPanel HorizontalAlignment="Center" Grid.Row="12" Orientation="Horizontal">
84-
<Button Margin="5" HorizontalAlignment="Center" Content="Build" Width="110" Height="30" Command="{Binding BuildCommand}" ToolTipService.ToolTip="The binary differential patch package is generated based on the difference between the two versions." />
85-
<CheckBox Margin="10,0,0,0" IsChecked="{Binding IsPublish}" Content="publish" VerticalAlignment="Center" />
234+
<StackPanel
235+
Grid.Row="12"
236+
HorizontalAlignment="Center"
237+
Orientation="Horizontal">
238+
<Button
239+
Width="110"
240+
Height="30"
241+
Margin="5"
242+
HorizontalAlignment="Center"
243+
Command="{Binding BuildCommand}"
244+
Content="Build"
245+
ToolTipService.ToolTip="The binary differential patch package is generated based on the difference between the two versions." />
246+
<CheckBox
247+
Margin="10,0,0,0"
248+
VerticalAlignment="Center"
249+
Content="publish"
250+
IsChecked="{Binding IsPublish}" />
86251
</StackPanel>
87252
</Grid>
88253
</UserControl>

0 commit comments

Comments
 (0)