private async void CheckIn(int roomId) { if (string.IsNullOrWhiteSpace(FirstName) || string.IsNullOrWhiteSpace(LastName) || SelectedRoom == null) { MessageDialog dialog = new MessageDialog("You must enter first and last name and select a room", "Error"); await dialog.ShowAsync(); return; } var sensor = new Sensor { FirstName = FirstName, LastName = LastName, SensorId = 5, SensorMac = "1" }; var presence = new SensorPresence { RoomId = roomId, SensorId = sensor.SensorId, TimeStamp = DateTime.Now }; await serverHubProxy.Invoke("RecordLocation", presence, sensor); navigationService.NavigateTo("checkedInList"); }
private void GetSensorLocation(Sensor sensor) { if (sensor == null) { MessageDialog msgBox = new MessageDialog("You must choose a sensor", "Error"); msgBox.ShowAsync(); return; } var result = serverHubProxy.Invoke<SensorPresence>("GetSensorPresence", sensor).Result; var room = serverHubProxy.Invoke<Room>("GetRoom", result.RoomId).Result; SensorLocation = string.Format($"{SelectedSensor.FullName} was in {room.Name} at {result.TimeStamp}"); }
private async void GetSensorsLocation(Sensor sensor) { try { var sensorPresence = await serverHubProxy.Invoke<SensorPresence>("GetSensorPresence", sensor); var room = await serverHubProxy.Invoke<Room>("GetRoom", sensorPresence.RoomId); SensorsLocation = $"{sensor.FullName} was in {room.Name} at {sensorPresence.TimeStamp}"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }