public void PopulateObjectAsync <T>(DataRetrieverObjectDelegate retrieverCallback, Action afterPopulate = null) where T : class, IBusinessObject, new() { if (GlobalUIRegistry.AsyncSettings.SynchroniseBackgroundOperations) { this.CurrentBusinessObject = retrieverCallback(); if (afterPopulate != null) { afterPopulate(); } return; } var data = new ConcurrentDictionary <string, object>(); data["businessobject"] = null; this.RunOnAsyncOperationStarted(); (new HabaneroBackgroundWorker()).Run(this, data, (d) => { d["businessobject"] = retrieverCallback(); return(true); }, (d) => { this.PopulateObjectFromAsyncUICallback(d, afterPopulate); }, null, this.NotifyObjectPopulationException); }
public void PopulateObjectAsync <T>(DataRetrieverObjectDelegate dataRetrieverCallback, Action afterPopulation = null) where T : class, IBusinessObject, new() { try { this.RunAsyncOperationStartedHandler(); this.CurrentBusinessObject = dataRetrieverCallback(); this.RunAsyncOperationCompleteHandler(); if (afterPopulation != null) { afterPopulation(); } } catch (Exception e) { if (this.OnAsyncOperationException != null) { this.OnAsyncOperationException(this, new ExceptionEventArgs(e)); } } }