library.network.maui/Network/Platforms/iOS/PlatformNetworkTask.cs
2023-09-12 16:29:43 +08:00

50 lines
887 B
C#

using Foundation;
namespace Blahblah.Library.Network;
partial class NetworkTask
{
public NSMutableData? Data => data;
NSMutableData? data;
public NetworkTask(string url, CancellationToken token)
{
Url = url;
Token = token;
data = new NSMutableData();
}
public void SetCompleted(NSHttpUrlResponse? response)
{
OnCompleted(response);
Dispose();
}
public virtual bool OnResponded(NSHttpUrlResponse response)
{
return true;
}
public virtual void OnReceived(int length)
{
}
protected abstract void OnCompleted(NSHttpUrlResponse? response);
private partial void DisposingInternal()
{
Disposing();
if (data != null)
{
data.Dispose();
data = null;
}
}
protected virtual void Disposing()
{
}
}