Browse Source
* Avoid AndroidX extensions in storage provider code * Add new ActivationKind.File * ActivationKind.File implementation for Android * ActivationKind.File implementation for macOS * ActivationKind.File implementation for iOS * Properly handle "file:" scheme on macOS backend * Remove unused PackageReferencepull/15367/head
committed by
GitHub
16 changed files with 198 additions and 123 deletions
@ -0,0 +1,28 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Avalonia.Controls.Platform; |
|||
using Avalonia.Metadata; |
|||
using Avalonia.Platform.Storage; |
|||
using Avalonia.Threading; |
|||
|
|||
namespace Avalonia.Controls.ApplicationLifetimes; |
|||
|
|||
[PrivateApi] |
|||
public abstract class ActivatableLifetimeBase : IActivatableLifetime |
|||
{ |
|||
public event EventHandler<ActivatedEventArgs>? Activated; |
|||
public event EventHandler<ActivatedEventArgs>? Deactivated; |
|||
|
|||
public virtual bool TryLeaveBackground() => false; |
|||
public virtual bool TryEnterBackground() => false; |
|||
|
|||
protected internal void OnActivated(ActivationKind kind) => OnActivated(new ActivatedEventArgs(kind)); |
|||
|
|||
protected internal void OnActivated(ActivatedEventArgs eventArgs) => |
|||
Dispatcher.UIThread.Send(_ => Activated?.Invoke(this, eventArgs)); |
|||
|
|||
protected internal void OnDeactivated(ActivationKind kind) => OnDeactivated(new ActivatedEventArgs(kind)); |
|||
|
|||
protected internal void OnDeactivated(ActivatedEventArgs eventArgs) => |
|||
Dispatcher.UIThread.Send(_ => Deactivated?.Invoke(this, eventArgs)); |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System.Collections.Generic; |
|||
using Avalonia.Platform.Storage; |
|||
|
|||
namespace Avalonia.Controls.ApplicationLifetimes; |
|||
|
|||
public sealed class FileActivatedEventArgs : ActivatedEventArgs |
|||
{ |
|||
public FileActivatedEventArgs(IReadOnlyList<IStorageItem> files) : base(ActivationKind.File) |
|||
{ |
|||
Files = files; |
|||
} |
|||
|
|||
public IReadOnlyList<IStorageItem> Files { get; } |
|||
} |
|||
Loading…
Reference in new issue