Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit e4158ec

Browse files
committed
[background] update delegate implementation
fixes https://github.com/MicrosoftDocs/xamarin-docs/issues/2420 from docs
1 parent 150f0e6 commit e4158ec

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

SimpleBackgroundTransfer/SimpleBackgroundTransfer/SimpleBackgroundTransferViewController.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ public UIImageView ImageView {
7070
}
7171
}
7272

73-
public class UrlSessionDelegate : NSUrlSessionDownloadDelegate
74-
{
73+
public class UrlSessionDelegate : NSObject, INSUrlSessionDownloadDelegate
74+
{
7575
public SimpleBackgroundTransferViewController controller;
7676

7777
public UrlSessionDelegate (SimpleBackgroundTransferViewController controller)
7878
{
7979
this.controller = controller;
8080
}
8181

82-
public override void DidWriteData (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long bytesWritten, long totalBytesWritten, long totalBytesExpectedToWrite)
82+
public void DidWriteData (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long bytesWritten, long totalBytesWritten, long totalBytesExpectedToWrite)
8383
{
8484
Console.WriteLine ("Set Progress");
8585
if (downloadTask == controller.downloadTask) {
@@ -91,7 +91,7 @@ public override void DidWriteData (NSUrlSession session, NSUrlSessionDownloadTas
9191
}
9292
}
9393

94-
public override void DidFinishDownloading (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, NSUrl location)
94+
public void DidFinishDownloading (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, NSUrl location)
9595
{
9696
Console.WriteLine ("Finished");
9797
Console.WriteLine ("File downloaded in : {0}", location);
@@ -121,7 +121,7 @@ public override void DidFinishDownloading (NSUrlSession session, NSUrlSessionDow
121121
}
122122
}
123123

124-
public override void DidCompleteWithError (NSUrlSession session, NSUrlSessionTask task, NSError error)
124+
public void DidCompleteWithError (NSUrlSession session, NSUrlSessionTask task, NSError error)
125125
{
126126
Console.WriteLine ("DidComplete");
127127
if (error == null)
@@ -137,12 +137,12 @@ public override void DidCompleteWithError (NSUrlSession session, NSUrlSessionTas
137137
controller.downloadTask = null;
138138
}
139139

140-
public override void DidResume (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long resumeFileOffset, long expectedTotalBytes)
140+
public void DidResume (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long resumeFileOffset, long expectedTotalBytes)
141141
{
142142
Console.WriteLine ("DidResume");
143143
}
144144

145-
public override void DidFinishEventsForBackgroundSession (NSUrlSession session)
145+
public void DidFinishEventsForBackgroundSession (NSUrlSession session)
146146
{
147147
using (AppDelegate appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate) {
148148
var handler = appDelegate.BackgroundSessionCompletionHandler;

0 commit comments

Comments
 (0)