[Network] Fix binding mistake in NWConnection. (#21174)
The 'nw_connection_set_viability_changed_handler' P/Invoke was originally bound as 'SetBooleanChangeHandler', which isn't quite right. So now bind it as 'SetViabilityChangeHandler', obsolete the old version and remove it in XAMCORE_5_0.
This commit is contained in:
Родитель
a854ebe1b8
Коммит
b2a5fd4199
|
@ -9,6 +9,7 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
|
@ -157,8 +158,20 @@ namespace Network {
|
|||
[DllImport (Constants.NetworkLibrary)]
|
||||
static extern unsafe void nw_connection_set_viability_changed_handler (IntPtr handle, void* callback);
|
||||
|
||||
#if !XAMCORE_5_0
|
||||
[Obsolete ("Use 'SetViabilityChangeHandler' instead.")]
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
public unsafe void SetBooleanChangeHandler (Action<bool> callback)
|
||||
{
|
||||
SetViabilityChangeHandler (callback);
|
||||
}
|
||||
#endif // !XAMCORE_5_0
|
||||
|
||||
/// <summary>Set a handler that is called when data can be sent or received.</summary>
|
||||
/// <param name="callback">The callback to call when data can be sent or received.</param>
|
||||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
public unsafe void SetViabilityChangeHandler (Action<bool> callback)
|
||||
{
|
||||
if (callback is null) {
|
||||
nw_connection_set_viability_changed_handler (GetCheckedHandle (), null);
|
||||
|
|
|
@ -42193,7 +42193,6 @@ M:Network.NWConnection.Send(System.Byte[],System.Int32,System.Int32,Network.NWCo
|
|||
M:Network.NWConnection.SendIdempotent(CoreFoundation.DispatchData,Network.NWContentContext,System.Boolean)
|
||||
M:Network.NWConnection.SendIdempotent(System.Byte[],Network.NWContentContext,System.Boolean)
|
||||
M:Network.NWConnection.SetBetterPathAvailableHandler(System.Action{System.Boolean})
|
||||
M:Network.NWConnection.SetBooleanChangeHandler(System.Action{System.Boolean})
|
||||
M:Network.NWConnection.SetPathChangedHandler(System.Action{Network.NWPath})
|
||||
M:Network.NWConnection.SetQueue(CoreFoundation.DispatchQueue)
|
||||
M:Network.NWConnection.SetStateChangeHandler(System.Action{Network.NWConnectionState,Network.NWError})
|
||||
|
|
Загрузка…
Ссылка в новой задаче