Busy indicator display when Entity Framework loads data

I already did this quite easily in the past with Silverlight, declaring BusyIndicator as my root element and binding the IsBusy property to the IsLoading property of the domain context created by the RIA services:

<toolkit:BusyIndicator IsBusy="{Binding Context.IsLoading}" >

Since the ObjectContext property created by the Entity Framework does not seem to have a property IsLoading, how can I bind the IsBusy property in WPF?

thank

+3
source share
1 answer

What I came up with:

Employment indicator from the extended WPF toolkit:

<extoolkit:BusyIndicator IsBusy="{Binding IsBusy}" BusyContent="Loading data..." >

In my base class representation model, I added the following method:

protected void ExecuteBackgroundProcess(Action action)
    {
        IsBusy = true;

        Task task = Task.Factory.StartNew(() => action()).ContinueWith((s) => this.IsBusy = false);
    }

, :

this.ExecuteBackgroundProcess(() =>
{
    var collection = _securityRepo.TakeOfType<Security>(10).ToObservableCollection();

    DispatcherHelper.CheckBeginInvokeOnUI(() =>
    {
        Securities = collection;
        RaisePropertyChanged("Securities");
    });                       
});

CodeProject : http://www.codeproject.com/KB/WPF/ThreadingComponent.aspx?msg=3319891

0

Source: https://habr.com/ru/post/1775887/


All Articles