private void FindingApm(object sender, WidgetIdEventArgs e) { BeginEventHandler beginAsync = (sa, ea, cb, state) => BeginFind(e.Id, sa, ea, cb, state); AsyncManager.RegisterAsyncTask(beginAsync, EndFind, null); AsyncManager.ExecuteRegisteredAsyncTasks(); }
void Finding(object sender, FindingWidgetEventArgs e) { if ((!e.Id.HasValue || e.Id <= 0) && String.IsNullOrEmpty(e.Name)) { return; } if (e.Id.HasValue && e.Id > 0) { AsyncManager.RegisterAsyncTask( (asyncSender, ea, callback, state) => // Begin widgetRepository.BeginFind(e.Id.Value, callback, state), result => // End { var widget = widgetRepository.EndFind(result); if (widget != null) { View.Model.Widgets.Add(widget); } }, result => { }, // Timeout null, false); } else { AsyncManager.RegisterAsyncTask( (asyncSender, ea, callback, state) => // Begin widgetRepository.BeginFindByName(e.Name, callback, state), result => // End { var widget = widgetRepository.EndFindByName(result); if (widget != null) { View.Model.Widgets.Add(widget); } }, result => { }, // Timeout null, false); } AsyncManager.ExecuteRegisteredAsyncTasks(); View.Model.ShowResults = true; }
void Load(object sender, EventArgs e) { View.Model.Messages.Add(ThreadMessage("View.Load event handled")); AsyncManager.RegisterAsyncTask( (asyncSender, ea, callback, state) => // Begin { View.Model.Messages.Add(ThreadMessage("Async task doStuff1 begin handler")); return(doStuff1.BeginInvoke(callback, state)); }, result => // End { var msg = doStuff1.EndInvoke(result); View.Model.Messages.Add(msg); View.Model.Messages.Add(ThreadMessage("Async task doStuff1 end handler")); }, result => // Timeout View.Model.Messages.Add(ThreadMessage("Async task doStuff1 timeout handler")), null, true ); AsyncManager.RegisterAsyncTask( (asyncSender, ea, callback, state) => // Begin { View.Model.Messages.Add(ThreadMessage("Async task doStuff2 begin handler")); return(doStuff2.BeginInvoke(callback, state)); }, result => // End { var msg = doStuff2.EndInvoke(result); View.Model.Messages.Add(msg); View.Model.Messages.Add(ThreadMessage("Async task doStuff2 end handler")); }, result => // Timeout View.Model.Messages.Add(ThreadMessage("Async task doStuff2 timeout handler")), null, true ); }
private void Load(object sender, EventArgs e) { View.Model.RecordViewLoad(); AsyncManager.RegisterAsyncTask(InvokeAsync); }
private void Load(object sender, EventArgs e) { View.Model.Append("View Load"); AsyncManager.RegisterAsyncTask(RunTasks); }
private void Load(object sender, EventArgs e) { View.Model.RecordViewLoad(); AsyncManager.RegisterAsyncTask(BeginInvoke, EndInvoke, null); }
private void FindingTap(object sender, WidgetIdEventArgs e) { AsyncManager.RegisterAsyncTask(() => FindingAsync(e.Id)); AsyncManager.ExecuteRegisteredAsyncTasks(); }