This project has moved and is read-only. For the latest updates, please go here.

BusyIndicator not being displayed.

Oct 23, 2013 at 7:54 AM
Hi everyone.

I have a situation that I haven't found any solutions for online yet and I was wondering if someone could help.

I'm trying to get the busy indicator to show when I navigate to a new page using Devexpress's NavigationService.

Here's the rub.

When you navigate to a new page, it invokes the "OnParameterChanged" method in the NEW page's viewmodel, does everything in there, then comes back and returns the method in the OLD page's viewmodel before navigating to the new page.

Here are code examples.
private void OnNavigateToLoadSheetAddItemsView()
        {
            var worker = new BackgroundWorker();
            //this is where the long running process should go
            worker.DoWork += (o, ea) =>
            {
                Dispatcher.CurrentDispatcher.Invoke((Action)(() => this.Navigate()));
            };
            worker.RunWorkerCompleted += (o, ea) =>
            {
                //work has completed. you can now interact with the UI
                this.IsBusy = false;
            };
            //set the IsBusy before you start the thread
            this.IsBusy = true;
            worker.RunWorkerAsync();
        }

        private void Navigate()
        {
            if (this.DetailItem.Id == Guid.Empty)
            {
                var LoadSheetId = _loadSheetRepository.Add(this.DetailItem);
                ServiceContainer.GetService<INavigationService>  ().Navigate("LoadSheetAddItemsView", LoadSheetId, this);
            }
            else
            {
                ServiceContainer.GetService<INavigationService>().Navigate("LoadSheetAddItemsView", this.DetailItem.Id, this);
            }
        }
when it hits the line "ServiceContainer.GetService<INavigationService> ().Navigate("LoadSheetAddItemsView", LoadSheetId, this);" , it runs the "OnParameterChanged" method in the "LoadSheetAddItemsViewModel", then returns and finished the "OnNavigateToLoadSheetAddItemsView" method before changing the view.

I want it to show the busy indicator while it's running the "OnParameterChanged" method in the new viewmodel.

I've checked and it's not hitting the "OnParameterChanged" method in the new Viewmodel at all anymore.

Can anyone help??

Kind Regards,
Devon Britton.
Oct 23, 2013 at 10:59 AM
I've managed to find a workaround.

It's a bit laborious to explain here but if anyone's interested they can leave a comment here and I'll contact them..

Thanks everyone...