public void PopulateCollectionAsync(DataRetrieverCollectionDelegate dataRetrieverCallback, Action afterPopulation = null)
        {
            if (GlobalUIRegistry.AsyncSettings.SynchroniseBackgroundOperations)
            {
                this.BusinessObjectCollection = dataRetrieverCallback();
                if (afterPopulation != null)
                {
                    afterPopulation();
                }
                return;
            }
            var data = new ConcurrentDictionary <string, object>();

            data["businessobjectcollection"] = null;
            this.RunOnAsyncOperationStarted();
            (new HabaneroBackgroundWorker()).Run(this, data,
                                                 (d) =>
            {
                d["businessobjectcollection"] = dataRetrieverCallback();
                return(true);
            },
                                                 (d) =>
            {
                this.PopulateFromAsyncUICallback(d, afterPopulation);
            },
                                                 null,
                                                 this.NotifyGridPopulationException);
        }
 public void PopulateCollectionAsync(DataRetrieverCollectionDelegate dataRetrieverCallback, Action afterPopulation = null)
 {
     if (this.OnAsyncOperationStarted != null)
     {
         this.OnAsyncOperationStarted(this, new EventArgs());
     }
     try
     {
         this.BusinessObjectCollection = dataRetrieverCallback();
         if (afterPopulation != null)
         {
             afterPopulation();
         }
         if (this.OnAsyncOperationComplete != null)
         {
             this.OnAsyncOperationComplete(this, new EventArgs());
         }
     }
     catch (Exception ex)
     {
         if (this.OnAsyncOperationException != null)
         {
             this.OnAsyncOperationException(this, new ExceptionEventArgs(ex));
         }
     }
 }
        public void PopulateCollectionAsync(DataRetrieverCollectionDelegate dataRetrieverCallback, Action afterPopulation = null)
        {
            if (this.OnAsyncOperationStarted != null)
            {
                this.OnAsyncOperationStarted(this, new EventArgs());
            }
            var data = new ConcurrentDictionary <string, object>();

            data["collection"] = null;
            (new HabaneroBackgroundWorker()).Run(this, data,
                                                 (d) => {
                d["collection"] = dataRetrieverCallback();
                return(true);
            },
                                                 (d) =>
            {
                this.PopulateCollectionUICallback(afterPopulation, d);
            },
                                                 null,
                                                 this.NotifyPopulationException);
            if (this.OnAsyncOperationComplete != null)
            {
                this.OnAsyncOperationComplete(this, new EventArgs());
            }
        }
Пример #4
0
 public void PopulateCollectionAsync(DataRetrieverCollectionDelegate dataRetrieverCallback, Action populateAfter = null)
 {
     this.RunAsyncOperationStartedHandler();
     this.BusinessObjectCollection = dataRetrieverCallback();
     this.RunAsyncOperationCompleteHandler();
     if (populateAfter != null)
     {
         populateAfter();
     }
 }