Skip to content

Commit

Permalink
fix _initTask
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Jul 12, 2022
1 parent 4569c93 commit 90fcc0c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
11 changes: 2 additions & 9 deletions src/Avalonia.WebView2/Avalonia.WebView2.csproj
Expand Up @@ -10,7 +10,7 @@
This package is necessary for Avalonia applications. To learn more about package versions checkout https://aka.ms/wv2-packageversion. To learn best practices checkout: https://aka.ms/wv2-bestpractices.
</Description>
<PackageTags>Web WebView Native native package Edge avalonia avaloniaui dotnet framework core Webview2</PackageTags>
<Version>1.0.1264.42-preview.220711.6</Version>
<Version>1.0.1264.42-preview.220712.8</Version>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>

Expand All @@ -19,21 +19,14 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
<DefineConstants>DISABLE_WEBVIEW2_CORE;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<ItemGroup>
<AvaloniaXaml Include="**\*.xaml" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) OR $(TargetFramework.StartsWith('netcoreapp')) OR $(TargetFramework.StartsWith('net5')) OR $(TargetFramework.StartsWith('net6')) ">
<PackageReference Include="WebView2.NativeAssets.Win32" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
</ItemGroup>

</Project>
12 changes: 8 additions & 4 deletions src/Avalonia.WebView2/WebView2.cs
Expand Up @@ -12,7 +12,7 @@ public partial class WebView2 : WebView2BaseType, IHwndHost, ISupportInitialize,

public static string? VersionString { get; private set; }

static WebView2()
public static void RefreshIsSupported()
{
#if !DISABLE_WEBVIEW2_CORE
#if !WINDOWS
Expand All @@ -35,6 +35,11 @@ static WebView2()
#endif
}

static WebView2()
{
RefreshIsSupported();
}

public WebView2()
{
if (IsInDesignMode)
Expand Down Expand Up @@ -294,8 +299,8 @@ IntPtr IHwndHost.WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref
/// </exception>
public Task EnsureCoreWebView2Async(CoreWebView2Environment? environment = null, CoreWebView2ControllerOptions? controllerOptions = null)
{
if (IsInDesignMode)
return Task.FromResult(0);
if (IsInDesignMode || !IsSupported)
return Task.CompletedTask;
VerifyNotClosedGuard();
VerifyBrowserNotCrashedGuard();
if (!CheckAccess())
Expand Down Expand Up @@ -330,7 +335,6 @@ public Task EnsureCoreWebView2Async(CoreWebView2Environment? environment = null,
/// <remarks>All the event handlers added here need to be removed in <see cref="M:Avalonia.Controls.WebView2.Dispose(System.Boolean)" />.</remarks>
async Task InitCoreWebView2Async(CoreWebView2Environment? environment = null, CoreWebView2ControllerOptions? controllerOptions = null)
{
if (!IsSupported) return;
WebView2 sender = this;
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Expand Up @@ -9,6 +9,6 @@
<PackageVersion Include="Avalonia.X11" Version="0.10.16" />
<PackageVersion Include="Avalonia.Skia" Version="0.10.16" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="WebView2.NativeAssets.Win32" Version="1.0.1264.42" />
<PackageVersion Include="WebView2.NativeAssets.Win32" Version="1.0.1264.43" />
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions src/WebView2.NativeAssets.Win32.nuspec
Expand Up @@ -3,21 +3,22 @@
<metadata minClientVersion="2.12">
<id>WebView2.NativeAssets.Win32</id>
<title>WebView2.NativeAssets.Win32</title>
<version>1.0.1264.42</version>
<version>1.0.1264.43</version>
<authors>https://github.com/AigioL</authors>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="file">LICENSE.txt</license>
<repository type="git" url="https://github.com/BeyondDimension/Avalonia.WebView2" />
<tags>Microsoft Web WebView Native native package Edge Avalonia dotnet framework core Webview2</tags>
<description>The WebView2 control enables you to embed web technologies (HTML, CSS, and JavaScript) in your native applications powered by Microsoft Edge (Chromium).
This package is necessary for Win32 C/C++, WPF, WinForms, and Avalonia applications. To learn more about package versions checkout https://aka.ms/wv2-packageversion. To learn best practices checkout: https://aka.ms/wv2-bestpractices.</description>
This package is necessary for Console and Avalonia applications. To learn more about package versions checkout https://aka.ms/wv2-packageversion. To learn best practices checkout: https://aka.ms/wv2-bestpractices.</description>
</metadata>
<files>
<file src="..\ref\Microsoft.Web.WebView2\LICENSE.txt" target="LICENSE.txt" />
<file src="..\ref\Microsoft.Web.WebView2\NOTICE.txt" target="NOTICE.txt" />
<file src="..\ref\Microsoft.Web.WebView2\lib\net45\Microsoft.Web.WebView2.Core.dll" target="lib\net45\Microsoft.Web.WebView2.Core.dll" />
<file src="..\ref\Microsoft.Web.WebView2\lib\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll" target="lib\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll" />
<file src="..\ref\Microsoft.Web.WebView2\lib\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll" target="lib\netstandard2.0\Microsoft.Web.WebView2.Core.dll" />
<file src="..\ref\Microsoft.Web.WebView2\runtimes\win-arm64\native\WebView2Loader.dll" target="runtimes\win-arm64\native\WebView2Loader.dll" />
<file src="..\ref\Microsoft.Web.WebView2\runtimes\win-x64\native\WebView2Loader.dll" target="runtimes\win-x64\native\WebView2Loader.dll" />
<file src="..\ref\Microsoft.Web.WebView2\runtimes\win-x86\native\WebView2Loader.dll" target="runtimes\win-x86\native\WebView2Loader.dll" />
Expand Down

0 comments on commit 90fcc0c

Please sign in to comment.