Browse Source
OSX: Handle applicationShouldTerminate # Conflicts: # src/Avalonia.Controls/ApiCompatBaseline.txtrelease/0.10.7
10 changed files with 111 additions and 17 deletions
@ -1,10 +1,13 @@ |
|||
Compat issues with assembly Avalonia.Controls: |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Controls.INativeMenuExporterEventsImplBridge.RaiseClosed()' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Controls.INativeMenuExporterEventsImplBridge.RaiseOpening()' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public System.EventHandler<System.ComponentModel.CancelEventArgs> Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime.ShutdownRequested' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime.add_ShutdownRequested(System.EventHandler<System.ComponentModel.CancelEventArgs>)' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime.remove_ShutdownRequested(System.EventHandler<System.ComponentModel.CancelEventArgs>)' is present in the implementation but not in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Controls.Embedding.Offscreen.OffscreenTopLevelImplBase.SetCursor(Avalonia.Platform.IPlatformHandle)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.AvaloniaProperty Avalonia.AvaloniaProperty Avalonia.Controls.Notifications.NotificationCard.CloseOnClickProperty' does not exist in the implementation but it does exist in the contract. |
|||
EnumValuesMustMatch : Enum value 'Avalonia.Platform.ExtendClientAreaChromeHints Avalonia.Platform.ExtendClientAreaChromeHints.Default' is (System.Int32)2 in the implementation but (System.Int32)1 in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.ICursorImpl)' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.IPlatformHandle)' is present in the contract but not in the implementation. |
|||
MembersMustExist : Member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.IPlatformHandle)' does not exist in the implementation but it does exist in the contract. |
|||
Total Issues: 7 |
|||
Total Issues: 11 |
|||
|
|||
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.ComponentModel; |
|||
|
|||
namespace Avalonia.Platform |
|||
{ |
|||
public interface IPlatformLifetimeEventsImpl |
|||
{ |
|||
/// <summary>
|
|||
/// Raised by the platform when a shutdown is requested.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Raised on on OSX via the Quit menu or right-clicking on the application icon and selecting Quit.
|
|||
/// </remarks>
|
|||
event EventHandler<CancelEventArgs> ShutdownRequested; |
|||
} |
|||
} |
|||
@ -1,14 +1,25 @@ |
|||
using System; |
|||
using System.ComponentModel; |
|||
using Avalonia.Native.Interop; |
|||
using Avalonia.Platform; |
|||
|
|||
namespace Avalonia.Native |
|||
{ |
|||
internal class AvaloniaNativeApplicationPlatform : CallbackBase, IAvnApplicationEvents |
|||
internal class AvaloniaNativeApplicationPlatform : CallbackBase, IAvnApplicationEvents, IPlatformLifetimeEventsImpl |
|||
{ |
|||
public event EventHandler<CancelEventArgs> ShutdownRequested; |
|||
|
|||
void IAvnApplicationEvents.FilesOpened(IAvnStringArray urls) |
|||
{ |
|||
((IApplicationPlatformEvents)Application.Current).RaiseUrlsOpened(urls.ToStringArray()); |
|||
} |
|||
|
|||
public int TryShutdown() |
|||
{ |
|||
if (ShutdownRequested is null) return 1; |
|||
var e = new CancelEventArgs(); |
|||
ShutdownRequested(this, e); |
|||
return (!e.Cancel).AsComBool(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue