public void ReportProgress(int workProcessed, int totalWork, string statusText, object progressState)
        {
            RefreshProgressChangedEventArgs refreshProgressChangedEventArgs = new RefreshProgressChangedEventArgs(this, workProcessed, totalWork, statusText, progressState);

            this.reportedProgress = true;
            this.ShellProgress.ReportProgress(workProcessed, totalWork, statusText);
            this.worker.ReportProgress(refreshProgressChangedEventArgs.ProgressPercentage, refreshProgressChangedEventArgs);
        }
        protected virtual void OnProgressChanged(RefreshProgressChangedEventArgs e)
        {
            RefreshProgressChangedEventHandler refreshProgressChangedEventHandler = (RefreshProgressChangedEventHandler)base.Events[RefreshableComponent.EventProgressChanged];

            if (refreshProgressChangedEventHandler != null)
            {
                refreshProgressChangedEventHandler(this, e);
            }
        }
        private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            RefreshProgressChangedEventArgs refreshProgressChangedEventArgs = (RefreshProgressChangedEventArgs)e.UserState;

            this.OnProgressChanged(refreshProgressChangedEventArgs);
            if (refreshProgressChangedEventArgs.IsFirstProgressReport)
            {
                ExTraceGlobals.ProgramFlowTracer.TracePerformance <RefreshableComponent, string, string>(0L, "Time:{1}. {2} First batch data arrived in UI thread. {0}", this, ExDateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.fff"), (this is DataTableLoader) ? (this as DataTableLoader).Table.TableName : string.Empty);
                this.OnFirstBatchDataArrived(EventArgs.Empty);
            }
        }
Example #4
0
 protected override void OnProgressChanged(RefreshProgressChangedEventArgs e)
 {
     ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader>((long)this.GetHashCode(), "-->DataTableLoader.OnProgressChanged: {0}", this);
     if (!e.CancellationPending)
     {
         this.RemoveExistingRows(e);
         DataTable dataTable = (DataTable)e.UserState;
         if (dataTable != null)
         {
             this.MoveRows(dataTable, this.Table, true);
         }
         base.OnProgressChanged(e);
     }
     ExTraceGlobals.ProgramFlowTracer.TraceFunction <DataTableLoader>((long)this.GetHashCode(), "<--DataTableLoader.OnProgressChanged: {0}", this);
 }
Example #5
0
 protected virtual void RemoveExistingRows(RefreshProgressChangedEventArgs e)
 {
     if (e.IsFirstProgressReport)
     {
         ResultsLoaderProfile resultsLoaderProfile = e.RequestArgument as ResultsLoaderProfile;
         if (resultsLoaderProfile != null && resultsLoaderProfile.LoadableFromProfilePredicate != null)
         {
             for (int i = this.Table.Rows.Count - 1; i >= 0; i--)
             {
                 DataRow row = this.Table.Rows[i];
                 if (resultsLoaderProfile.IsLoadable(row))
                 {
                     this.Table.Rows.Remove(row);
                 }
             }
             return;
         }
         if (e.IsFullRefresh)
         {
             ExTraceGlobals.ProgramFlowTracer.TraceDebug <DataTableLoader>((long)this.GetHashCode(), "DataTableLoader.OnProgressChanged: clearing table as this is the first progress report of this refresh. {0}", this);
             this.Table.Clear();
             return;
         }
         PartialRefreshRequestEventArgs partialRefreshRequestEventArgs = e.Request as PartialRefreshRequestEventArgs;
         if (partialRefreshRequestEventArgs != null)
         {
             DataTable dataTable = (DataTable)e.UserState;
             foreach (object identity in partialRefreshRequestEventArgs.Identities)
             {
                 if (this.FindRowByIdentity(dataTable, identity) == null)
                 {
                     DataRow dataRow = this.FindRowByIdentity(this.Table, identity);
                     if (dataRow != null)
                     {
                         this.Table.Rows.Remove(dataRow);
                     }
                 }
             }
         }
     }
 }
 public RefreshProgressChangedEventArgs(RefreshRequestEventArgs request, int workProcessed, int totalWork, string statusText, object userState) : base(RefreshProgressChangedEventArgs.GetPercentage(workProcessed, totalWork), userState)
 {
     if (request == null)
     {
         throw new ArgumentNullException("request");
     }
     this.request               = request;
     this.workProcessed         = workProcessed;
     this.totalWork             = totalWork;
     this.statusText            = statusText;
     this.isFirstProgressReport = !request.ReportedProgress;
 }