public AlertInfoPage (EIMAAlert alert) { // display the information associated with the alert var sender = new Label { Text = "Sent by: " + alert.sender + "\n", FontSize = 20 }; var message = new Label { Text = alert.message + "\n", FontSize = 20 }; var type = new Label { Text = "Alert Type: " + alert.alertType, FontSize = 20 }; var time = new Label { Text = "Timestamp: " + alert.timestamp, FontSize = 20 }; var command1 = new Command (async o => await Application.Current.MainPage.Navigation.PopModalAsync ()); var backButton = new Button { Text = "Back", HorizontalOptions = LayoutOptions.End, Command = command1, }; var stackLayout = new StackLayout (); stackLayout.Children.Add (sender); stackLayout.Children.Add (message); stackLayout.Children.Add (type); stackLayout.Children.Add (time); stackLayout.Children.Add (backButton); Content = stackLayout; }
static void updateAlertsData (JObject alertsData) { var data = DataManager.getInstance (); var theList = new List<EIMAAlert> (); var alerts = (JArray)alertsData ["alerts"]; foreach (JObject item in alerts.Children()) { var toAdd = new EIMAAlert (); toAdd.sender = (string)item ["sender"]; toAdd.message = (string)item ["message"]; toAdd.timestamp = (long)item ["timestamp"]; theList.Add (toAdd); } data.setAlerts (theList); }
//Get Alerts public List<EIMAAlert> getAlerts(){ var toRet = new List<EIMAAlert> (); JArray alerts = (JArray)dataStore ["incident"] ["alerts"]; foreach (JObject item in alerts.Children()) { var toAdd = new EIMAAlert (); toAdd.sender = (string)item ["sender"]; toAdd.message = (string)item ["message"]; toAdd.timestamp = (long)item ["timestamp"]; toRet.Add (toAdd); } return toRet; }