public void CreateAsync() { var worker = new CreateTaskWorkerDelegate(CreateCollage); var completedCallback = new AsyncCallback(CreateTaskCompletedCallback); lock (this.sync) { if (this.isBusy) { ThrowExceptions.Custom(Exc.GetStackTrace(), type, Exc.CallingMethod(), "The engine is currently busy."); } AsyncOperation async = AsyncOperationManager.CreateOperation(null); var context = new CreateCollageAsyncContext(); bool cancelled; worker.BeginInvoke(async, context, out cancelled, completedCallback, async); this.isBusy = true; this.createTaskContext = context; } }
public void CreateAsync() { var worker = new CreateTaskWorkerDelegate(CreateCollage); var completedCallback = new AsyncCallback(CreateTaskCompletedCallback); lock (this.sync) { if (this.isBusy) { throw new InvalidOperationException("The engine is currently busy."); } AsyncOperation async = AsyncOperationManager.CreateOperation(null); var context = new CreateCollageAsyncContext(); bool cancelled; worker.BeginInvoke(async, context, out cancelled, completedCallback, async); this.isBusy = true; this.createTaskContext = context; } }