User Profile & Activity

Ruan Naude Member

Hi Yudi


Hmmm... I'm not 100% sure that I've fixed the problem, but it's retrieving- and displaying the data successfully...

What I did was:

->decrease the first _takeCount integer value.

->set the size of pages way, way smaller.

->instead of fixing an entity type to the grid, i changed "tmptestValReg" (which was the initial type) to type of object. (and this seemed to do the trick somehow)

But thank you for your responses.

(was actually trying to make a screenshot when i realized the UI was not hanging).

What I meant with "UI freezez" is that the notification from the VM to the view never happened, you couldn't click anyware on the UI (Then the browser stoppes responding), and if you leave it long enough, the application throws a "SystemOutOfMemory Exception", but I'm guessing this happened because of the amount of data that I was pulling at a time.

Thank you for your reply Yudi


Okay, let's start (from the start):

The XAML for the grid I'm trying to add is the following -

----------------------------------------------------------------------------------------------------------------------------

<Intersoft:UXGridView x:Name="AssetRegister" ItemsSource="{Binding AssetCollection, Mode=TwoWay}" BorderThickness="0"
		      HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
		      HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
		      Grid.Row="1" SelectionMode="Single" SelectedItem="{Binding SelectedAsset, Mode=TwoWay}"
                      GroupByBoxVisibility="{Binding ShowGroupBox, Converter={StaticResource BooleanToVisibilityConverter}}" 
		      IsBusy="{Binding IsBusy}" CanUserBatchUpdate="False"
		      CanUserPage="True" PageSize="100000" EnableRowVirtualization="False" />

 ----------------------------------------------------------------------------------------------------------------------------

This is the View...

I'm aware that the grid automatically generates columns, thus I've left it out.

The ViewModel contains a Property (ObservableCollection) AssetCollection, which gets populated from the database when the VM gets constructed.

The VM also contains a Property (Boolean) IsBusy, which changes based on the query state to populate the AssetCollection Property.

The VM also contains a Property (Boolean) ShowGroupBox to enable/disable grouping.


Now, we use Caliburn-Micro to tie up our views and view-models, and we use (DevForce)Ideablade to handle our model needs.


The following is the code on my VM to retrieve the data from the database -

        private void RetrieveRecords()
        {
            _query = AREM.Instance.tmptestValRegs.OrderBy(asset => asset.ComponentID).Skip(_skipCount).Take(_takeCount);
            _backendThread = new SelectMany<tmptestValReg>(_query);
            IsBusy = true;
            _backendThread.Execute((hasError, response) =>
                                       {
                                           if (response != null) 
                                               AssetCollection.AddRange(response);
                                           _skipCount = _skipCount + _takeCount;
                                           if ((_takeCount*2) < 50000)
                                               _takeCount = _takeCount * 2;
                                           else
                                               _takeCount = 50000;
                                       });
            _backendThread.Completed += QueryCompleted;
        }
        void QueryCompleted(object sender, ResultCompletionEventArgs e)
        {
            if (_backendThread.Response.Count() < _originalTakeCount)
            {
                IsBusy = false;
                _tempCollection = AssetCollection;
                return;
            }
            RetrieveRecords();
        }

 The "RetrieveRecords" method gets called from the constructor.

After the initial retrieval, the _skipCount increases and the "RetrieveRecords" gets called again, causing a recursive retrieval untill there aren't any

records retrieved.

I have notify-handlers which "tells" the UI when a Property has ben changed.

Please let me know if there is anything else that I can tell you to help solve the problem (as I really want to move from our current 3rd-party controls to yours).


All times are GMT -5. The time now is 7:41 AM.
Previous Next