Beispiel #1
0
        private void EndDataUpdate(DataProviderStatusChangedEventArgs e)
        {
            if (e.NewStatus == DataProviderStatus.Faulted || e.NewStatus == DataProviderStatus.Uninitialized)
            {
                this.layoutController.ScheduleCleanUp();
                this.ResumeUpdateService(ListView.UpdateFlags.AllButData);
                return;
            }

            if (!this.isDataProviderUpdating)
            {
                // System.Diagnostics.Debug.Assert(false, "Flag not raised properly.");
                return;
            }

            if (e.NewStatus != DataProviderStatus.Ready || !e.ResultsChanged)
            {
                return;
            }

            //// NOTE: This call comes from another thread and everything related to the UI should be dispatched on the UI thread.
            //// It will also clear the IndexTree which will definitely throw NullReference exception if some UI operation is requested before Dispatcher is invoked.
            //// To solve this issue it will be better to create new Layout class and replace the existing one when dispatched to the Main thread.
            //// this.SetLayoutSource();
            this.View.UpdateService.DispatchOnUIThread(
                true,
                () =>
            {
                if (this.CurrentDataProvider.Status != DataProviderStatus.Ready)
                {
                    // This may happen if during the Dispatching on UI thread we have a change in the provider - e.g. ItemsSource change.
                    return;
                }

                if (this.hasPendingDataRefresh)
                {
                    this.hasPendingDataRefresh = false;
                    this.RefreshData();
                    return;
                }

                this.SetLayoutSource();
                this.RestoreCollapsedState();

                ListView.UpdateFlags uiUpdateflags = ListView.UpdateFlags.AffectsContent;

                this.dataChangeFlags        = DataChangeFlags.None;
                this.isDataProviderUpdating = false;

                System.Diagnostics.Debug.Assert(!uiUpdateflags.HasFlag(ListView.UpdateFlags.AffectsData), "The AffectsData flag should not be raised here!");
                this.ResumeUpdateService(uiUpdateflags);

                this.NotifyView(this.CurrentDataProvider.Status);
            });
        }
Beispiel #2
0
 private void ResumeUpdateService(ListView.UpdateFlags flags)
 {
     this.View.UpdateService.RegisterUpdate((int)flags);
     this.View.UpdateService.ResumeUpdates();
 }
Beispiel #3
0
 internal void OnUpdate(ListView.UpdateFlags updateFlags)
 {
     this.layoutController.OnUpdate(updateFlags);
 }