Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal abstract class ViewModel : IViewModel
- {
- private readonly AutoResetEvent autoResetEvent = new AutoResetEvent(true);
- protected Task SynchronousTask(IList<Action> actions)
- {
- var initialTask = new Task(() => this.autoResetEvent.WaitOne());
- for (var i = 0; i < actions.Count; i++)
- {
- var i1 = i;
- initialTask.ContinueWith(task => actions[i1]());
- }
- initialTask.ContinueWith(task => this.autoResetEvent.Set());
- initialTask.Start();
- return initialTask;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement