Showing modal page when new page is loading

IanPunchIanPunch USMember ✭✭

Hi, need some assistance here. Our devices are a bit rubbish so some pages take a while to appear. So what I want to do is show a modal screen that I have already which I use as a work in progress modal. I cant get the modal to appear when i press button to change page, it waits and then appears once new page is loaded. Any advice here? I have tried creating async tasks but not getting anywhere

Button method to load page

DisplayWorkInProgressModal("Loading", "Loading Page", null); LoadPage<NewOrdersCarouselViewModel>(pageParams);

protected void LoadPage<T>(BasePageParameters pageParameters) where T : BaseViewModel { Device.BeginInvokeOnMainThread(() => { ShowViewModel<T>(pageParameters); }); }

public void DisplayWorkInProgressModal(string title, string progressMessage, CancellationTokenSource runningTaskCancellationTokenSource) { // Need to run on UI thread Device.BeginInvokeOnMainThread(() => { MessagingCenter.Send<BaseViewModel, WorkInProgressModalPageParameters>(this, MessageDescriptions.ShowWorkInProgressModal , new WorkInProgressModalPageParameters() { Title = title, ProgressMessage = progressMessage, RunningTaskCancellationTokenSource = runningTaskCancellationTokenSource }); }); }

`MessagingCenter.Subscribe<BaseViewModel, WorkInProgressModalPageParameters>(this, MessageDescriptions.ShowWorkInProgressModal, (sender, parameters) =>
if (_workInProgressModal == null)
_workInProgressModal = new WorkInProgressModalPage();

            Navigation.PushModalAsync(_workInProgressModal, true);


Sign In or Register to comment.