We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to wait asynchronously until the popup closes(accept/decline button was hit)

Thread ID:

Created:

Updated:

Platform:

Replies:

141911 Jan 10,2019 10:25 AM UTC Jan 16,2019 12:58 PM UTC Xamarin.Forms 3
loading
Tags: SfPopup
Tamas Cons
Asked On January 10, 2019 10:25 AM UTC

Hello.We changed our popups in up with syncfusion popups but in some places we need the popups to be asynchronous/The show popup method to be awaitable.Is there any way to achieve this? Thanks,Regards

Subburaj Pandian Veluchamy [Syncfusion]
Replied On January 11, 2019 10:47 AM UTC

Hi Tamas, 
 
Thank you for contacting Syncfusion support. 
 
Based on the provided information, we have checked your requirement of waiting asynchronously when closing the Popup layout by clicking accept / close option in Xamarin.Forms can be achievable by setting delay in the Closing event of PopupLayout. This event will while closing the Popup layout, using Cancel argument you can handle whether to close Popup or not. Please refer the following code example for the same, 
 
[c#] 
popupLayout.Closing += PopupLayout_Closing; 
 
        private void PopupLayout_Closing(object sender, System.ComponentModel.CancelEventArgs e) 
        { 
            var delay = System.DateTime.Now.AddMilliseconds(2000); 
            while (true) 
            { 
                if (System.DateTime.Now >= delay) 
                { 
                    e.Cancel = false; 
                    break; 
                } 
            } 
        } 
 
 
We have prepared sample based on your requirement by setting delay while opening and closing the Popup, please find the sample by the following link. 
 
 
 
Please let us know, if this helpful. 
 
Regards,
Subburaj Pandian V 


Tamas Cons
Replied On January 14, 2019 08:42 AM UTC

Hi Tamas, 
 
Thank you for contacting Syncfusion support. 
 
Based on the provided information, we have checked your requirement of waiting asynchronously when closing the Popup layout by clicking accept / close option in Xamarin.Forms can be achievable by setting delay in the Closing event of PopupLayout. This event will while closing the Popup layout, using Cancel argument you can handle whether to close Popup or not. Please refer the following code example for the same, 
 
[c#] 
popupLayout.Closing += PopupLayout_Closing; 
 
        private void PopupLayout_Closing(object sender, System.ComponentModel.CancelEventArgs e) 
        { 
            var delay = System.DateTime.Now.AddMilliseconds(2000); 
            while (true) 
            { 
                if (System.DateTime.Now >= delay) 
                { 
                    e.Cancel = false; 
                    break; 
                } 
            } 
        } 
 
 
We have prepared sample based on your requirement by setting delay while opening and closing the Popup, please find the sample by the following link. 
 
 
 
Please let us know, if this helpful. 
 
Regards,
Subburaj Pandian V 


hello.thanks for the reply.No that is not the case I was looking for. 
The question is whether we can show the popup asynchronously or not.

Please find the following case:

if (!isValidPwd)
{
StopSpinningOperation();
var syncFusionConfirm = new SyncFusionAlert(string.Empty,
string.Format(AppResources.CHECK_NETWORK_KO, lcWiFiData.SSID),
xx.Localization.AppResources.CONTINUE,
xx.Localization.AppResources.CANCEL);
syncFusionConfirm.PopupView.DeclineCommand = new Command(() => { return; });
syncFusionConfirm.Show();
//DoStuff
}

I only want to execute the //DoStuff part when the user has hit accept(because as you can see on decline we want to exit the method syncFusionConfirm.PopupView.DeclineCommand = new Command(() => { return; }); ).
But in order to be able to achieve this,we need to wait until the user has hit accept or decline and not to continue with the flow until then.

How can we achieve this?
Thanks,Norbert

Note: //DoStuff is a complicated part ,and it does not work to put it in the AcceptCommand, we need to execute that after the popup has been "resolved"/closed.

Jagadeesan Pichaimuthu [Syncfusion]
Replied On January 16, 2019 12:58 PM UTC

Hi Tamas, 

Thanks for the update. 

We have analyzed the reported query and you can perform your additional operation when popupview is open by using the Opened event in Xamarin.Forms. 

[C#] 
popupLayout.Opened += PopupLayout_Opened; 
 
private async void PopupLayout_Opened(object sender, EventArgs e) 
{ 
// Codes that needs to be executed once popup is visible in the screen. 
} 
 
We have prepared sample for your requirement please follow the below link. 
 
 
Please let us know, if this is helpful. 

Regards, 
Jagadeesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon