void ShowActionAlert(PushDemoAction action) => MainThread.BeginInvokeOnMainThread(() => MainPage?.DisplayAlert("PushDemo", $"{action} action received", "OK").ContinueWith((task) => { if (task.IsFaulted) { throw task.Exception; } }));
void TakeAction(PushDemoAction action) => MainThread.BeginInvokeOnMainThread(() => { try { var Page = (MainPage as NavigationPage).RootPage as MainTabbedPage; if (Page != null) //mainpage là trang tabbedpage { Page.CurrentPage = Page.Children[1]; } else { // vẫn ở trang login, login xong vào thẳng trang thông báo MainPage = new NavigationPage(new Login(1)); } } catch (Exception e) { } });
void NotificationActionTriggered(object sender, PushDemoAction e) => ShowActionAlert(e);
void NotificationActionTriggered(object sender, PushDemoAction e) => TakeAction(e);