protected async override void OnAppearing() { base.OnAppearing(); //Wake.BindingContext = await App.AlarmsDB.GetAlarmsAsync(); alarm = await App.AlarmsDB.GetAlarmsAsync(); //Wake.Time = alarm.WakeTime; System.Diagnostics.Debug.WriteLine(alarm.WakeTime); //Breakfast.Time = alarm.BreakfastTime; //Wake.BindingContext = alarm.WakeTime; Wake.Time = alarm.WakeTime; Breakfast.Time = alarm.BreakfastTime; Lunch.Time = alarm.LunchTime; Dinner.Time = alarm.DinnerTime; Sleep.Time = alarm.SleepTime; //MedsListView.ItemsSource = await App.Database.GetMedsAsync(); }
public Task <int> SaveAlarmsAsync(Alarms time) { System.Diagnostics.Debug.WriteLine(time); System.Diagnostics.Debug.WriteLine("AlarmId = " + time.AlarmId); BluetoothManager.Instance.CheckBluetoothConnection(); /* * Task.Factory.StartNewTaskContinuously(() => * { * //If device is disconnected, note that medication hasn't been missed and reconnect * if (BluetoothManager.Instance.AdapterBLE.ConnectedDevices.Count == 0) * { * * //Reconnect to BLEDevice * if (BluetoothManager.Instance.BLEDevice != null) * { * BluetoothManager.Instance.OnConnectionLost(BluetoothManager.Instance.BLEDevice); * } * else * { * System.Diagnostics.Debug.WriteLine("Cannot Reconnect. Device Not Found."); * } * } * else * { * System.Diagnostics.Debug.WriteLine("Device still connected. Medication has not yet been taken"); * } * * }, token, (TimeSpan.FromSeconds(1)));*/ if (time.AlarmId != 0) { System.Diagnostics.Debug.WriteLine(time); return(alarmsdatabase.UpdateAsync(time)); } else { System.Diagnostics.Debug.WriteLine(time.WakeTime); return(alarmsdatabase.InsertAsync(time)); } }