Skip to content

Commit d04037d

Browse files
committed
关于界面翻新,添加使用的第三方软件的链接
1 parent ca3704c commit d04037d

File tree

3 files changed

+67
-48
lines changed

3 files changed

+67
-48
lines changed
Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Page
3-
x:Class="Edge.AboutItem"
3+
x:Class="Edge.About"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:local="using:Edge"
77
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
88
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
99
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
1010
mc:Ignorable="d">
11-
<StackPanel Spacing="10" Margin="15">
12-
11+
<StackPanel Spacing="5" Margin="10">
1312
<controls:SettingsCard
1413
Header="WebView2"
15-
Description="{x:Bind browserVersion}">
16-
<Button Name="CopyChromiumVersionButton"
17-
Click="CopyChromiumVersion"
18-
Content="复制"/>
14+
Description="{x:Bind webViewVersion}">
15+
<Button
16+
Content="复制"
17+
Click="CopyWebViewVersion" />
1918
</controls:SettingsCard>
2019

2120
<controls:SettingsCard
@@ -24,9 +23,9 @@
2423
Click="CheckUpdate"
2524
IsClickEnabled="True"
2625
IsActionIconVisible="False">
27-
<Button Name="CopyAppVersionButton"
28-
Click="CopyAppVersion"
29-
Content="复制"/>
26+
<Button
27+
Content="复制"
28+
Click="CopyAppVersion" />
3029
</controls:SettingsCard>
3130

3231
<controls:SettingsCard
@@ -38,15 +37,17 @@
3837
</controls:SettingsCard.ActionIcon>
3938
</controls:SettingsCard>
4039

41-
<TextBlock>
42-
<Span>
43-
<Run>此浏览器基于</Run>
44-
<Hyperlink NavigateUri="https://www.chromium.org/">Chromium</Hyperlink>
45-
<Run>开源项目及其他</Run>
46-
<Hyperlink NavigateUri="edge://credits/">开源软件</Hyperlink>
47-
<Run>。</Run>
48-
</Span>
49-
</TextBlock>
40+
<controls:SettingsExpander
41+
Header="开源及第三方软件"
42+
ItemsSource="{x:Bind OpenSources}">
43+
<controls:SettingsExpander.ItemTemplate>
44+
<DataTemplate x:DataType="local:OpenSource">
45+
<HyperlinkButton
46+
Content="{x:Bind Name}"
47+
NavigateUri="{x:Bind Uri}"
48+
Margin="5" />
49+
</DataTemplate>
50+
</controls:SettingsExpander.ItemTemplate>
51+
</controls:SettingsExpander>
5052
</StackPanel>
51-
5253
</Page>
Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,61 @@
44
using Microsoft.Windows.AppNotifications;
55
using Microsoft.Windows.AppNotifications.Builder;
66
using System;
7+
using System.Collections.Generic;
78
using System.IO;
89
using System.Net.Http;
910
using Windows.ApplicationModel.DataTransfer;
11+
using Windows.System;
1012

1113
namespace Edge
1214
{
13-
public sealed partial class AboutItem : Page
15+
public class OpenSource(string uri, string name)
16+
{
17+
public string Uri = uri;
18+
public string Name = name;
19+
}
20+
21+
public sealed partial class About : Page
1422
{
1523
public string appVersion = File.ReadAllText("./Assets/version.txt");
16-
public string browserVersion = CoreWebView2Environment.GetAvailableBrowserVersionString();
24+
public string webViewVersion = CoreWebView2Environment.GetAvailableBrowserVersionString();
1725

18-
public AboutItem()
26+
public List<OpenSource> OpenSources = [];
27+
28+
public About()
1929
{
2030
this.InitializeComponent();
31+
OpenSources =
32+
[
33+
new("https://github.com/CommunityToolkit/Windows", "Windows Community Toolkit"),
34+
new("https://aka.ms/webview", "Microsoft.Web.WebView2"),
35+
new("https://github.com/microsoft/windowsappsdk", "Microsoft.WindowsAppSDK"),
36+
new("https://aka.ms/WinSDKProjectURL", "Microsoft.Windows.SDK.BuildTools"),
37+
new("https://github.com/dotnet/runtime", "System.Text.Encoding.CodePages"),
38+
new("https://github.com/BreeceW/WinUIEdit", "WinUIEdit")
39+
];
40+
}
41+
42+
private static void CopyText(string text)
43+
{
44+
DataPackage package = new();
45+
package.SetText(text);
46+
Clipboard.SetContent(package);
47+
}
48+
49+
private void CopyWebViewVersion(object sender, RoutedEventArgs e)
50+
{
51+
CopyText(webViewVersion);
52+
}
53+
54+
private void CopyAppVersion(object sender, RoutedEventArgs e)
55+
{
56+
CopyText(appVersion);
57+
}
58+
59+
private async void OpenRepoWebsite(object sender, RoutedEventArgs e)
60+
{
61+
await Launcher.LaunchUriAsync(new("https://github.com/wtcpython/WinUIEdge"));
2162
}
2263

2364
private async void CheckUpdate(object sender, RoutedEventArgs e)
@@ -43,29 +84,5 @@ private async void CheckUpdate(object sender, RoutedEventArgs e)
4384
}
4485
catch (Exception) { }
4586
}
46-
47-
private static void CopyText(string text)
48-
{
49-
DataPackage package = new();
50-
package.SetText(text);
51-
Clipboard.SetContent(package);
52-
}
53-
54-
private void CopyChromiumVersion(object sender, RoutedEventArgs e)
55-
{
56-
CopyText(browserVersion);
57-
}
58-
59-
private void CopyAppVersion(object sender, RoutedEventArgs e)
60-
{
61-
CopyText(appVersion);
62-
}
63-
64-
private void OpenRepoWebsite(object sender, RoutedEventArgs e)
65-
{
66-
MainWindow mainWindow = App.GetWindowForElement(this);
67-
mainWindow.AddNewTab(new WebViewPage(new("https://github.com/wtcpython/WinUIEdge")));
68-
}
6987
}
7088
}
71-

Settings/SettingsPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
<FontIcon Glyph="&#xE777;" />
4646
</NavigationViewItem.Icon>
4747
</NavigationViewItem>
48-
<NavigationViewItem Content="关于 Edge" Tag="AboutItem">
48+
49+
<NavigationViewItem Content="关于" Tag="About">
4950
<NavigationViewItem.Icon>
5051
<FontIcon Glyph="&#xe713;" />
5152
</NavigationViewItem.Icon>

0 commit comments

Comments
 (0)