Skip to content

Commit 4920370

Browse files
committed
add in WD Upgrade
1 parent 1d5dfe3 commit 4920370

File tree

11 files changed

+299
-0
lines changed

11 files changed

+299
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Application
2+
x:Class="Upgrade.WPF.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:Upgrade.WPF"
6+
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
7+
StartupUri="MainWindow.xaml">
8+
<Application.Resources>
9+
<ResourceDictionary>
10+
<ResourceDictionary.MergedDictionaries>
11+
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Blue.xaml" />
12+
<!-- 需要注意 wd:Resources 必须在配色主题后,Theme="Dark" 为黑色皮肤 -->
13+
<wd:Resources Theme="Dark" />
14+
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Theme.xaml" />
15+
</ResourceDictionary.MergedDictionaries>
16+
</ResourceDictionary>
17+
</Application.Resources>
18+
</Application>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Configuration;
2+
using System.Data;
3+
using System.Windows;
4+
5+
namespace Upgrade.WPF
6+
{
7+
/// <summary>
8+
/// Interaction logic for App.xaml
9+
/// </summary>
10+
public partial class App : Application
11+
{
12+
}
13+
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]
16.3 KB
Loading
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<wd:Window
2+
x:Class="Upgrade.WPF.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:Upgrade.WPF"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
9+
Title="General Update 客户端演示"
10+
Width="800"
11+
Height="450"
12+
Icon="GeneralUpdate.png"
13+
WindowStartupLocation="CenterScreen"
14+
mc:Ignorable="d">
15+
<Grid>
16+
<wd:NotifyIcon Name="WpfNotifyIcon" Title="General Update 客户端演示" />
17+
<Button
18+
HorizontalAlignment="Center"
19+
VerticalAlignment="Center"
20+
wd:ElementHelper.CornerRadius="3"
21+
Click="BtnUpgrade1_Click"
22+
Content="Upgrade Window "
23+
Style="{StaticResource WD.PrimaryButton}" />
24+
</Grid>
25+
</wd:Window>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Windows;
2+
using Upgrade.WPF.Views;
3+
using MessageBox = WPFDevelopers.Controls.MessageBox;
4+
5+
namespace Upgrade.WPF
6+
{
7+
/// <summary>
8+
/// Interaction logic for MainWindow.xaml
9+
/// </summary>
10+
public partial class MainWindow
11+
{
12+
public MainWindow()
13+
{
14+
InitializeComponent();
15+
Closing += MainWindow_Closing;
16+
}
17+
18+
private void BtnUpgrade1_Click(object sender, System.Windows.RoutedEventArgs e)
19+
{
20+
new UpgradeWindow().ShowDialog();
21+
}
22+
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
23+
{
24+
if (MessageBox.Show("是否退出当前系统?", "询问", MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
25+
{
26+
e.Cancel = true;
27+
}
28+
}
29+
}
30+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net8.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<UseWPF>true</UseWPF>
9+
<ApplicationIcon>WPFDevelopers.ico</ApplicationIcon>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<None Remove="GeneralUpdate.png" />
13+
</ItemGroup>
14+
<ItemGroup>
15+
<Content Include="WPFDevelopers.ico" />
16+
</ItemGroup>
17+
<ItemGroup>
18+
<PackageReference Include="WPFDevelopers" Version="0.0.0.1" />
19+
</ItemGroup>
20+
<ItemGroup>
21+
<Resource Include="GeneralUpdate.png" />
22+
</ItemGroup>
23+
</Project>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<wd:Window
2+
x:Class="Upgrade.WPF.Views.UpgradeWindow"
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:Upgrade.WPF.Views"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
9+
Title="UpgradeWindow 01"
10+
Width="300"
11+
Height="400"
12+
BorderBrush="Transparent"
13+
BorderThickness="0"
14+
Icon="/GeneralUpdate.png"
15+
NoChrome="True"
16+
ResizeMode="NoResize"
17+
TitleBackground="{DynamicResource WD.BackgroundSolidColorBrush}"
18+
TitleHeight="30"
19+
WindowStartupLocation="CenterScreen"
20+
WindowStyle="ToolWindow"
21+
mc:Ignorable="d">
22+
<wd:Window.TitleBar>
23+
<Grid Height="40" VerticalAlignment="Center">
24+
<Grid.ColumnDefinitions>
25+
<ColumnDefinition Width="Auto" />
26+
<ColumnDefinition Width="*" />
27+
<ColumnDefinition Width="Auto" MinWidth="30" />
28+
</Grid.ColumnDefinitions>
29+
<Image
30+
Width="20"
31+
Height="20"
32+
Margin="4,0"
33+
Source="/GeneralUpdate.png" />
34+
<TextBlock
35+
Grid.Column="1"
36+
VerticalAlignment="Center"
37+
FontSize="14"
38+
Foreground="{StaticResource WD.SecondaryTextSolidColorBrush}"
39+
IsHitTestVisible="False"
40+
Text="General Update 01 客户端升级" />
41+
<Button
42+
x:Name="CloseButton"
43+
Grid.Column="2"
44+
Width="30"
45+
Height="30"
46+
HorizontalAlignment="Right"
47+
Click="CloseButton_Click"
48+
Style="{StaticResource WD.WindowButtonStyle}"
49+
ToolTip="关闭">
50+
<wd:PathIcon
51+
Width="10"
52+
Height="10"
53+
Kind="WindowClose" />
54+
</Button>
55+
</Grid>
56+
</wd:Window.TitleBar>
57+
<Grid>
58+
<Grid.RowDefinitions>
59+
<RowDefinition Height="20" />
60+
<RowDefinition />
61+
<RowDefinition />
62+
</Grid.RowDefinitions>
63+
<Border
64+
Grid.Row="1"
65+
HorizontalAlignment="Center"
66+
VerticalAlignment="Center">
67+
<wd:SmallPanel>
68+
<!--<Image
69+
x:Name="PART_Image"
70+
Width="100"
71+
Height="100"
72+
Source="/GeneralUpdate.png"
73+
Stretch="Uniform" />-->
74+
<wd:BreathLamp
75+
Width="140"
76+
Height="140"
77+
GradientStopColor1="#FF00cec9"
78+
GradientStopColor2="#2000cec9"
79+
IsLampStart="True"
80+
LampEffect="Streamer">
81+
<Ellipse Width="100" Height="100">
82+
<Ellipse.Fill>
83+
<ImageBrush ImageSource="pack://application:,,,/GeneralUpdate.png" />
84+
</Ellipse.Fill>
85+
</Ellipse>
86+
</wd:BreathLamp>
87+
<wd:CircularProgressBar x:Name="PART_Slider" Value="{Binding ElementName=CirularSlider, Path=Value}" />
88+
</wd:SmallPanel>
89+
</Border>
90+
<Grid
91+
Grid.Row="2"
92+
Margin="0,0,0,30"
93+
VerticalAlignment="Center">
94+
<Rectangle
95+
Width="190"
96+
Height="40"
97+
Fill="Black"
98+
Opacity=".2"
99+
RadiusX="20"
100+
RadiusY="20" />
101+
<TextBlock
102+
HorizontalAlignment="Center"
103+
VerticalAlignment="Center"
104+
FontSize="18"
105+
Foreground="#D3DDD4"
106+
Text="{Binding ElementName=PART_Slider, Path=Value, StringFormat={}正在更新...{0}%}" />
107+
</Grid>
108+
</Grid>
109+
</wd:Window>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System.Windows;
2+
using WPFDevelopers.Controls;
3+
4+
namespace Upgrade.WPF.Views
5+
{
6+
/// <summary>
7+
/// UpgradeWindow1.xaml 的交互逻辑
8+
/// </summary>
9+
public partial class UpgradeWindow
10+
{
11+
private double currentProgress = 0;
12+
private const double Radius = 100;
13+
public UpgradeWindow()
14+
{
15+
InitializeComponent();
16+
Loaded += UpgradeWindow_Loaded;
17+
18+
}
19+
20+
private void UpgradeWindow_Loaded(object sender, RoutedEventArgs e)
21+
{
22+
StartDownload();
23+
}
24+
25+
private void CloseButton_Click(object sender, RoutedEventArgs e)
26+
{
27+
Close();
28+
}
29+
private async void StartDownload()
30+
{
31+
for (double i = 0; i <= 100; i += 1)
32+
{
33+
UpdateProgressArc(i);
34+
await Task.Delay(100);
35+
}
36+
}
37+
38+
private void UpdateProgressArc(double value)
39+
{
40+
PART_Slider.Value = value;
41+
if (value >= 100)
42+
NotifyIcon.ShowBalloonTip("提醒", " 已更新到最新版本,当前版本 V9.0", NotifyIconInfoType.Info);
43+
}
44+
}
45+
}
83.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)