public async void Run(IBackgroundTaskInstance taskInstance) { System.Diagnostics.Debug.WriteLine("WE are @ Background"); _deferral = taskInstance.GetDeferral(); _taskInstance = taskInstance; _taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled); GattCharacteristicNotificationTriggerDetails details = (GattCharacteristicNotificationTriggerDetails)taskInstance.TriggerDetails; //get the characteristics data and get heartbeat value out from it byte[] ReceivedData = new byte[details.Value.Length]; DataReader.FromBuffer(details.Value).ReadBytes(ReceivedData); HeartbeatMeasurement tmpMeasurement = HeartbeatMeasurement.GetHeartbeatMeasurementFromData(ReceivedData); System.Diagnostics.Debug.WriteLine("Background heartbeast values: " + tmpMeasurement.HeartbeatValue); // send heartbeat values via progress callback _taskInstance.Progress = tmpMeasurement.HeartbeatValue; //update the value to the Tile LiveTile.UpdateSecondaryTile("" + tmpMeasurement.HeartbeatValue); //Check if we are within the limits, and alert by starting the app if we are not alertType alert = await checkHeartbeatLevels(tmpMeasurement.HeartbeatValue); _deferral.Complete(); }
public AlertMessages(string message, alertType type) { InitializeComponent(); switch (type) { case alertType.success: this.BackColor = Color.SeaGreen; pictureBox1.Image = Image.FromFile(Application.StartupPath + "/icons8_ok_filled.ico"); textMsg.Text = message; break; case alertType.info: this.BackColor = Color.Blue; textMsg.Text = message; break; case alertType.warning: this.BackColor = Color.Goldenrod; textMsg.Text = message; pictureBox1.Image = Image.FromFile(Application.StartupPath + "/icons8_warning_shield.ico"); break; case alertType.error: this.BackColor = Color.Maroon; textMsg.Text = message; pictureBox1.Image = Image.FromFile(Application.StartupPath + "/icons8_error_filled.ico"); break; } }
public Alert(string text, alertType type, DateTime time) { this.text = text; this.type = type; this.time = time; }