public async void StartToasting() { if (toasterConsumer != null) { ToasterStartToastingResult toasterStartToastingResult = await toasterConsumer.StartToastingAsync(); if (toasterStartToastingResult.Status == AllJoynStatus.Ok) { // success } } }
public IAsyncOperation <ToasterStartToastingResult> StartToastingAsync(AllJoynMessageInfo info) { Task <ToasterStartToastingResult> task = new Task <ToasterStartToastingResult>(() => { Task toast = Task.Factory.StartNew(ToastTask, token); return(ToasterStartToastingResult.CreateSuccessResult()); }); task.Start(); return(task.AsAsyncOperation()); }