Created
March 13, 2012 21:55
-
-
Save wwahammy/2032015 to your computer and use it in GitHub Desktop.
Holy cow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// TODO: holy cow, is this confusing | |
/// </summary> | |
public Task<IEnumerable<string>> SystemFeeds | |
{ | |
get | |
{ | |
var tcs = new TaskCompletionSource<IEnumerable<string>>(); | |
var list = new List<string>(); | |
Pm.ListFeeds(default(int?), default(int?), | |
new PackageManagerMessages{ | |
Error = (a, b, c) => tcs.SetException(new Exception()), | |
NoFeedsFound = () => tcs.SetResult(Enumerable.Empty<string>()), | |
FeedDetails = (s, d, b1, b2, b3) => | |
{ | |
if (!b1) | |
lock (list) | |
{ | |
list.Add(s); | |
} | |
} | |
}).ContinueWith((t) => | |
{ | |
if (tcs.Task.IsCompleted || tcs.Task.IsFaulted) | |
{ | |
//no feeds! | |
} | |
else | |
{ | |
tcs.SetResult(list); | |
} | |
}); | |
return tcs.Task; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment