Browse Source
Merge pull request #11506 from AvaloniaUI/fix-browser-getitemsasync
Fix browser GetItemsAsync + ICustomDrawOperation
pull/11532/head
Benedikt Stebner
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
10 additions and
3 deletions
-
src/Avalonia.Base/Rendering/Composition/Drawing/RenderDataDrawingContext.cs
-
src/Browser/Avalonia.Browser/Interop/StorageHelper.cs
-
src/Browser/Avalonia.Browser/Storage/BrowserStorageProvider.cs
|
|
|
@ -177,7 +177,10 @@ internal class RenderDataDrawingContext : DrawingContext |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public override void Custom(ICustomDrawOperation custom) => Add(new RenderDataCustomNode()); |
|
|
|
public override void Custom(ICustomDrawOperation custom) => Add(new RenderDataCustomNode |
|
|
|
{ |
|
|
|
Operation = custom |
|
|
|
}); |
|
|
|
|
|
|
|
public override void DrawGlyphRun(IBrush? foreground, GlyphRun? glyphRun) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -39,6 +39,9 @@ internal static partial class StorageHelper |
|
|
|
|
|
|
|
[JSImport("StorageItem.openRead", AvaloniaModule.StorageModuleName)] |
|
|
|
public static partial Task<JSObject> OpenRead(JSObject item); |
|
|
|
|
|
|
|
[JSImport("StorageItem.createFromHandle", AvaloniaModule.StorageModuleName)] |
|
|
|
public static partial JSObject? StorageItemFromHandle(JSObject handle); |
|
|
|
|
|
|
|
[JSImport("StorageItem.getItemsIterator", AvaloniaModule.StorageModuleName)] |
|
|
|
[return: JSMarshalAs<JSType.Object>] |
|
|
|
|
|
|
|
@ -319,13 +319,14 @@ internal class JSStorageFolder : JSStorageItem, IStorageBookmarkFolder |
|
|
|
} |
|
|
|
|
|
|
|
var kind = storageItem.GetPropertyAsString("kind"); |
|
|
|
var item = StorageHelper.StorageItemFromHandle(storageItem)!; |
|
|
|
switch (kind) |
|
|
|
{ |
|
|
|
case "directory": |
|
|
|
yield return new JSStorageFolder(storageItem); |
|
|
|
yield return new JSStorageFolder(item); |
|
|
|
break; |
|
|
|
case "file": |
|
|
|
yield return new JSStorageFile(storageItem); |
|
|
|
yield return new JSStorageFile(item); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|