public Task <OfflineRegionDto[]> GetOfflineRegions() { var tcs = new TaskCompletionSource <OfflineRegionDto[]>(); _offlineManager.ListOfflineRegions(new OfflineRegionCallback() { OnListCallback = regions => { tcs.SetResult(regions.Select(Transform).ToArray()); }, OnErrorCallback = offlineRegionError => { tcs.SetResult(null); } }); return(tcs.Task); }
public Task <OfflinePack[]> GetPacks() { var tcs = new TaskCompletionSource <OfflinePack[]>(); offlineManager.ListOfflineRegions(new ListOfflineRegionsCallback() { OnErrorHandle = ((msg) => { System.Diagnostics.Debug.WriteLine("[ERROR] Couldn't get offline packs: " + msg); tcs.TrySetResult(null); }), OnListHandle = ((regs) => { var output = regs.Select((reg) => reg.ToFormsPack()); tcs.TrySetResult(output.ToArray()); }) }); return(tcs.Task); }