This commit is contained in:
Redth 2022-01-06 11:59:45 -05:00
Родитель 1794453c15
Коммит 925d133e9c
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -42,11 +42,11 @@ namespace Microsoft.Maui.Handlers
#if __MACCATALYST__
class NSApplication
{
static IntPtr ClassHandle => ObjCRuntime.Class.GetHandle("NSApplication");
static IntPtr SharedApplicationSelector => ObjCRuntime.Selector.GetHandle("sharedApplication");
static IntPtr TerminateSelector => ObjCRuntime.Selector.GetHandle("terminate:");
static NativeHandle ClassHandle => ObjCRuntime.Class.GetHandle("NSApplication");
static NativeHandle SharedApplicationSelector => ObjCRuntime.Selector.GetHandle("sharedApplication");
static NativeHandle TerminateSelector => ObjCRuntime.Selector.GetHandle("terminate:");
readonly IntPtr _handle;
readonly NativeHandle _handle;
NSApplication(NativeHandle handle)
{
@ -54,16 +54,16 @@ namespace Microsoft.Maui.Handlers
}
public static NSApplication SharedApplication =>
new(IntPtr_objc_msgSend(ClassHandle, SharedApplicationSelector));
new(NativeHandle_objc_msgSend(ClassHandle, SharedApplicationSelector));
public void Terminate() =>
void_objc_msgSend_IntPtr(_handle, TerminateSelector, IntPtr.Zero);
void_objc_msgSend_NativeHandle(_handle, TerminateSelector, NativeHandle.Zero);
[DllImport(ObjCRuntime.Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")]
static extern IntPtr IntPtr_objc_msgSend(IntPtr receiver, IntPtr selector);
static extern NativeHandle NativeHandle_objc_msgSend(NativeHandle receiver, NativeHandle selector);
[DllImport(ObjCRuntime.Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")]
static extern void void_objc_msgSend_IntPtr(IntPtr receiver, IntPtr selector, IntPtr arg1);
static extern void void_objc_msgSend_NativeHandle(NativeHandle receiver, NativeHandle selector, NativeHandle arg1);
}
#endif
}