Initial commit: WebView2 demo project

This commit is contained in:
2026-07-01 15:42:23 +08:00
commit dccef49a6d
26 changed files with 684 additions and 0 deletions
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
+70
View File
@@ -0,0 +1,70 @@
#pragma checksum "..\..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "F0F542B2B3024CA65F35885C9EA866081FA55664"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Controls.Ribbon;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using WebView2Demo;
namespace WebView2Demo {
/// <summary>
/// App
/// </summary>
public partial class App : System.Windows.Application {
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.28.0")]
public void InitializeComponent() {
#line 5 "..\..\..\App.xaml"
this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative);
#line default
#line hidden
}
/// <summary>
/// Application Entry Point.
/// </summary>
[System.STAThreadAttribute()]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.28.0")]
public static void Main() {
WebView2Demo.App app = new WebView2Demo.App();
app.InitializeComponent();
app.Run();
}
}
}
Binary file not shown.
+97
View File
@@ -0,0 +1,97 @@
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "69BCCFAD6A1F84FCC9DF73D3B82763158668A03B"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Microsoft.Web.WebView2.Wpf;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Controls.Ribbon;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
namespace WebView2Demo {
/// <summary>
/// MainWindow
/// </summary>
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
#line 12 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal Microsoft.Web.WebView2.Wpf.WebView2 WebView;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.28.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/WebView2Demo;component/mainwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\..\MainWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.28.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.WebView = ((Microsoft.Web.WebView2.Wpf.WebView2)(target));
return;
case 2:
#line 17 "..\..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.RefreshPage);
#line default
#line hidden
return;
}
this._contentLoaded = true;
}
}
}
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("WebView2Demo")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("WebView2Demo")]
[assembly: System.Reflection.AssemblyTitleAttribute("WebView2Demo")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]
// 由 MSBuild WriteCodeFragment 类生成。
@@ -0,0 +1 @@
6f678735046a50135cfc693bf479a7211ebf0a20adab6750f610c0a87155c424
@@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net8.0-windows
build_property.TargetPlatformMinVersion = 7.0
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = WebView2Demo
build_property.ProjectDir = E:\CSharp-Learning\WebView2Demo\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
@@ -0,0 +1,6 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.Linq;
global using global::System.Threading;
global using global::System.Threading.Tasks;
Binary file not shown.
@@ -0,0 +1 @@
2b4238706a52336505e15e3066d412e1db81f490fe0977c416bc2c1b71aaa2b9
@@ -0,0 +1,11 @@
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo.csproj.AssemblyReference.cache
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\MainWindow.baml
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\MainWindow.g.cs
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\App.g.cs
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo_Content.g.cs
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo_MarkupCompile.cache
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo.g.resources
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo.GeneratedMSBuildEditorConfig.editorconfig
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo.AssemblyInfoInputs.cache
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo.AssemblyInfo.cs
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\WebView2Demo.csproj.CoreCompileInputs.cache
Binary file not shown.
@@ -0,0 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("webview2loader.dll")]
[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("webview2loader.dll")]
[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("webview2loader.dll")]
@@ -0,0 +1,20 @@
WebView2Demo
winexe
C#
.cs
E:\CSharp-Learning\WebView2Demo\obj\Debug\net8.0-windows\
WebView2Demo
none
false
TRACE;DEBUG;NET;NET8_0;NETCOREAPP
E:\CSharp-Learning\WebView2Demo\App.xaml
11407045341
3-1398119429
41617472463
201889356744
MainWindow.xaml;
False