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; }
private void FindingTap(object sender, WidgetIdEventArgs e) { AsyncManager.RegisterAsyncTask(() => FindingAsync(e.Id)); AsyncManager.ExecuteRegisteredAsyncTasks(); }