/// <summary> /// Called when this app control event received. /// </summary> /// <param name="e">AppControlReceivedEventArgs</param> protected override async void OnAppControlReceived(AppControlReceivedEventArgs e) { Console.WriteLine("OnAppControlReceived"); base.OnAppControlReceived(e); AppControl appControl = e.ReceivedAppControl; var navi = app.MainPage as NavigationPage; var currentPage = navi.CurrentPage; try { if (appControl.ExtraData.Count() != 0) { string AlarmCreatedDate = appControl.ExtraData.Get <string>("AlarmRecord.UniqueIdentifier"); Console.WriteLine($"ExtraData.Count() != 0 AlarmCreatedDate:{AlarmCreatedDate}"); if (AlarmModel.AlarmRecordDictionary == null) { // Need to retrieve at the page creation time AlarmModel.AlarmRecordDictionary = AlarmPersistentHandler.DeserializeAlarmRecord(); } AlarmRecord retrievedRecord; if (AlarmModel.AlarmRecordDictionary != null) { if (AlarmModel.AlarmRecordDictionary.TryGetValue(AlarmCreatedDate, out retrievedRecord)) { if (retrievedRecord == null) { Console.WriteLine("[OnAppControlReceived] retrievedRecord is null!!"); } Console.WriteLine("retrievedRecord:" + retrievedRecord); if (retrievedRecord != null && retrievedRecord.AlarmState < AlarmStates.Inactive) { _alertPageModel = new AlertPageModel(retrievedRecord); await currentPage.Navigation.PushAsync(new AlarmAlertPage(_alertPageModel)); } } } } } catch (Exception ex) { Console.WriteLine("[OnAppControlReceived] Exception - Message: " + ex.Message + ", source: " + ex.Source + ", " + ex.StackTrace); } }
/// <summary> /// AlarmAlertPage constructor. /// </summary> /// <param name="viewModel">AlertPageModel</param> public AlarmAlertPage(AlertPageModel viewModel) { Console.WriteLine("AlarmAlertPage"); InitializeComponent(); BindingContext = _viewModel = viewModel; _viewModel.StartAlert(); // Subscribe notification of locale changes to update text based on locale MessagingCenter.Subscribe <LocaleHandler, CultureInfo>(this, MessageKeys.LanguageChanged, (obj, culture) => { Console.WriteLine($"AlarmAlertPage receviced LanguageChanged"); // Update text that has been translated into the current language. TimeLabel.Text = _viewModel.Record.ScheduledDateTime.ToString("hh:mm tt"); DismissButton.Text = AppResources.Dismiss; }); }