public GetTask ( string name ) : IBackgroundTaskRegistration | ||
name | string | |
Результат | IBackgroundTaskRegistration |
public void Run(IBackgroundTaskInstance taskInstance) { var defferal = taskInstance.GetDeferral(); var taskHelper = new TaskHelper(); var signalingTask = taskHelper.GetTask(nameof(SignalingTask)); var connOwner = new ConnectionOwner { OwnerId = signalingTask.TaskId.ToString() }; Hub.Instance.SignalingSocketService.ConnectToSignalingServer(connOwner); Hub.Instance.SignalingClient.Register(new Registration { Name = RegistrationSettings.Name, UserId = RegistrationSettings.UserId, Domain = RegistrationSettings.Domain, PushNotificationChannelURI = RegistrationSettings.PushNotificationChannelURI }); defferal.Complete(); }
void UnRegisterAllBackgroundTask() { var helper = new TaskHelper(); var signalingReg = helper.GetTask(nameof(SignalingTask)); if (signalingReg != null) signalingReg.Unregister(true); var regOp = helper.GetTask(nameof(PushNotificationTask)); if (regOp != null) regOp.Unregister(true); }
private static async System.Threading.Tasks.Task<IBackgroundTaskRegistration> RegisterSignalingTask(TaskHelper helper, bool registerAgain = true) { var signalingTask = helper.GetTask(nameof(SignalingTask)) ?? await helper.RegisterTask(nameof(SignalingTask), typeof(SignalingTask).FullName, new SocketActivityTrigger(), registerAgain).AsTask(); return signalingTask; }
private static async Task<IBackgroundTaskRegistration> RegisterSessionConnectedTask(TaskHelper helper) { var sessionConnTask = helper.GetTask(nameof(SessionConnectedTask)) ?? await helper.RegisterTask(nameof(SessionConnectedTask), typeof(SessionConnectedTask).FullName, new SystemTrigger(SystemTriggerType.InternetAvailable, oneShot: false), removeIfRegistered: false); return sessionConnTask; }