I use RgPlugn PopUp page in my xamarin app and I want to check if this pop pages open or not because I kick user from app when session time is over. If there is no RgPlugn PopUp page it will go null exception error. How can I check RgPlugn PopUp page is null or not ? I use this code to kick out user.
private void RedirectAndInformInactivity()
{
Device.BeginInvokeOnMainThread(async () =>
{
await Application.Current.MainPage.DisplayAlert("Oturum Sonlandı!", "İşlem yapmadığınız için oturumunuz sonlandırılıyor!", "Tamam");
await PopupNavigation.Instance.PopAsync();
await Application.Current.MainPage.Navigation.PushAsync(new LogoutPage());
});
}
You may check whether a pop-up has been opened.
//Verifying whether any popup pages are present in the PopupStack
//It returns true if there are any pop-up pages in the PopupStack.
if (Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopupStack.Any())
{
List<PopupPage> popupPageList = new List<PopupPage>();
popupPageList = Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopupStack.ToList();
// popupPageList contains all of the pages that are present in the PopupStack, which you can validate according to your requirements.
}
else
{
//Popup stack is empty
}