Browse Source

Update to avalonia 0.10.10

Justin 3 years ago
parent
commit
40ff23326e
2 changed files with 13 additions and 2 deletions
  1. 1 1
      CefGlue.Avalonia/CefGlue.Avalonia.csproj
  2. 12 1
      CefGlue.Avalonia/CursorsProvider.cs

+ 1 - 1
CefGlue.Avalonia/CefGlue.Avalonia.csproj

@@ -21,7 +21,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Avalonia" Version="0.10.0" />
+    <PackageReference Include="Avalonia" Version="0.10.10" />
     <PackageReference Include="Vinno.CefGlue" Version="1.1.0" />
     <PackageReference Include="Vinno.CefGlue.Common" Version="1.1.0" />
   </ItemGroup>

+ 12 - 1
CefGlue.Avalonia/CursorsProvider.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.Linq;
 using Avalonia.Input;
 
 namespace Xilium.CefGlue.Avalonia
@@ -17,7 +18,17 @@ namespace Xilium.CefGlue.Avalonia
             foreach(StandardCursorType type in Enum.GetValues(typeof(StandardCursorType)))
             {
                 var cursor = new Cursor(type);
-                _cache[cursor.PlatformCursor.Handle] = cursor;
+                var platformImpl = cursor.PlatformImpl;
+                if (platformImpl != null)
+                {
+                    var platformImplType = platformImpl.GetType();
+                    var handleProperty = platformImplType.GetProperties().FirstOrDefault(x => x.Name == "Handle");
+                    if (handleProperty != null)
+                    {
+                        var handle = (IntPtr)handleProperty.GetValue(platformImpl);
+                        _cache[handle] = cursor;
+                    }
+                }
             }
         }