protected virtual PartialOrder ComparePartialOrder(RefreshRequestEventArgs leftValue, RefreshRequestEventArgs rightValue)
        {
            PartialOrder result = int.MinValue;

            if (leftValue.IsFullRefresh)
            {
                result = (rightValue.IsFullRefresh ? 0 : 1);
            }
            else if (rightValue.IsFullRefresh)
            {
                result = -1;
            }
            else
            {
                PartialRefreshRequestEventArgs partialRefreshRequestEventArgs  = leftValue as PartialRefreshRequestEventArgs;
                PartialRefreshRequestEventArgs partialRefreshRequestEventArgs2 = rightValue as PartialRefreshRequestEventArgs;
                if (!partialRefreshRequestEventArgs.Identities.IsEmptyCollection() && !partialRefreshRequestEventArgs2.Identities.IsEmptyCollection())
                {
                    if (partialRefreshRequestEventArgs.Identities.Length > partialRefreshRequestEventArgs2.Identities.Length)
                    {
                        if (RefreshableComponent.IsSubsetOf(partialRefreshRequestEventArgs.Identities, partialRefreshRequestEventArgs2.Identities))
                        {
                            result = 1;
                        }
                    }
                    else if (RefreshableComponent.IsSubsetOf(partialRefreshRequestEventArgs2.Identities, partialRefreshRequestEventArgs.Identities))
                    {
                        result = -1;
                    }
                }
            }
            return(result);
        }
예제 #2
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);
                     }
                 }
             }
         }
     }
 }