返回提交历史
Modified
XFEExtension.NetCore.WinUIHelper.TestApp/App.xaml.cs
+1
-0
Modified
XFEExtension.NetCore.WinUIHelper.TestApp/ViewModels/WebViewTestPageViewModel.cs
+22
-3
Modified
XFEExtension.NetCore.WinUIHelper.TestApp/Views/AppShellPage.xaml
+5
-0
Modified
XFEExtension.NetCore.WinUIHelper.TestApp/Views/WebViewTestPage.xaml
+1
-1
Modified
XFEExtension.NetCore.WinUIHelper.TestApp/Views/WebViewTestPage.xaml.cs
+10
-0
Modified
XFEExtension.NetCore.WinUIHelper/XFEExtension.NetCore.WinUIHelper.csproj
+2
-2
XFEstudio/XFEExtension.NetCore.WinUIHelper
添加IWebView服务
bd2c364
代码差异
6 个文件
+41
-6
@@ -26,6 +26,7 @@ namespace XFEExtension.NetCore.WinUIHelper.TestApp
26
26
PageManager.RegisterPage(typeof(AppShellPage));
27
27
PageManager.RegisterPage(typeof(MainPage));
28
28
PageManager.RegisterPage(typeof(TestPage));
29
PageManager.RegisterPage(typeof(WebViewTestPage));
29
30
PageManager.RegisterPage(typeof(SettingPage));
30
31
UnhandledException += App_UnhandledException;
31
32
}
@@ -1,16 +1,35 @@
1
using XFEExtension.NetCore.WinUIHelper.Interface.Services;
1
using Microsoft.UI.Xaml.Controls;
2
using System.Threading.Tasks;
3
using XFEExtension.NetCore.WinUIHelper.Interface.Services;
2
4
using XFEExtension.NetCore.WinUIHelper.Utilities;
3
5
4
6
namespace XFEExtension.NetCore.WinUIHelper.TestApp.ViewModels;
5
7
6
8
public partial class WebViewTestPageViewModel : ViewModelBase
7
9
{
8
public IAutoNavigationParameterService<string> AutoNavigationParameterService { get; set; } = ServiceManager.GetService<IAutoNavigationParameterService<string>>();
10
public IAutoNavigationParameterService<string> AutoNavigationParameterService { get; } = ServiceManager.GetService<IAutoNavigationParameterService<string>>();
11
public IWebViewService WebViewService { get; } = ServiceManager.GetService<IWebViewService>();
9
12
10
public WebViewTestPageViewModel() => AutoNavigationParameterService.ParameterChange += AutoNavigationParameterService_ParameterChange;
13
public WebViewTestPageViewModel()
14
{
15
WebViewService.Initialized += WebViewService_Initialized;
16
AutoNavigationParameterService.ParameterChange += AutoNavigationParameterService_ParameterChange;
17
}
11
18
12
19
private void AutoNavigationParameterService_ParameterChange(object? sender, string? e)
13
20
{
14
21
15
22
}
23
24
25
private async void WebViewService_Initialized(WebView2 sender, CoreWebView2InitializedEventArgs args)
26
{
27
if (args.Exception is null)
28
{
29
while (await sender.CoreWebView2.CookieManager.GetCookiesAsync("https://mms.pinduoduo.com") is { } cookies && !cookies.Any(cookie => cookie.Name == "JSESSIONID"))
30
{
31
Console.WriteLine();
32
}
33
}
34
}
16
35
}
@@ -58,6 +58,11 @@
58
58
<FontIcon Glyph=""/>
59
59
</NavigationViewItem.Icon>
60
60
</NavigationViewItem>
61
<NavigationViewItem Content="测试网页" add:NavigationAddition.NavigateTo="XFEExtension.NetCore.WinUIHelper.TestApp.Views.WebViewTestPage">
62
<NavigationViewItem.Icon>
63
<FontIcon Glyph=""/>
64
</NavigationViewItem.Icon>
65
</NavigationViewItem>
61
66
</NavigationViewItem.MenuItems>
62
67
</NavigationViewItem>
63
68
</NavigationView.MenuItems>
@@ -9,6 +9,6 @@
9
9
mc:Ignorable="d">
10
10
11
11
<Grid>
12
<WebView2/>
12
<WebView2 x:Name="webView" Source="https://mms.pinduoduo.com"/>
13
13
</Grid>
14
14
</Page>
@@ -1,3 +1,5 @@
1
using Microsoft.UI.Xaml.Navigation;
2
1
3
namespace XFEExtension.NetCore.WinUIHelper.TestApp.Views;
2
4
3
5
/// <summary>
@@ -9,6 +11,14 @@ public sealed partial class WebViewTestPage : Page
9
11
public WebViewTestPageViewModel ViewModel { get; set; } = new();
10
12
public WebViewTestPage()
11
13
{
14
Current = this;
12
15
InitializeComponent();
16
ViewModel.AutoNavigationParameterService.Initialize(this);
17
ViewModel.WebViewService.Initialize(webView);
18
}
19
20
protected override void OnNavigatedTo(NavigationEventArgs e)
21
{
22
ViewModel.AutoNavigationParameterService.OnParameterChange(e.Parameter);
13
23
}
14
24
}
@@ -9,7 +9,7 @@
9
9
<Nullable>enable</Nullable>
10
10
<GenerateDocumentationFile>True</GenerateDocumentationFile>
11
11
<Title>XFEExtension.NetCore.WinUIHelper</Title>
12
<Version>1.2.1</Version>
12
<Version>1.2.2</Version>
13
13
<Authors>XFEstudio</Authors>
14
14
<PackageIcon>logoIcon.png</PackageIcon>
15
15
<Description>WinUI的各种工具类,帮助开发者快速构建一个模块化的WinUI项目</Description>
@@ -17,7 +17,7 @@
17
17
<NeutralLanguage>zh-CN</NeutralLanguage>
18
18
<PackageReadmeFile>README.md</PackageReadmeFile>
19
19
<PackageReleaseNotes>
20
修复导航中的部分bug
20
添加IWebView服务
21
21
</PackageReleaseNotes>
22
22
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
23
23
<PackageProjectUrl>https://github.com/XFEstudio/XFEExtension.NetCore.WinUIHelper</PackageProjectUrl>