/// <summary> /// Attempts to log the user in /// </summary> /// <param name="parameter">The <see cref="SecureString"/> passed in from the view for the users password</param> /// <returns></returns> public async Task Create(object parameter) { await RunCommand(() => this.CreateIsRunning, async() => { try { FirebaseConfiguration.client = new FireSharp.FirebaseClient(FirebaseConfiguration.config); var patient = new Patient { Id = this.PatientID, Name = this.PatientName, Age = Convert.ToInt32(this.PatientAge), Gender = this.PatientGender, MaxGraph = 0, MinGraph = 0, RateGraph = 0 }; bool flag = FirebaseConfiguration.CheckData(patient); if (flag) { SetResponse response = await FirebaseConfiguration.client.SetAsync("Patient/" + PatientID, patient); Patient result = response.ResultAs <Patient>(); CurrentPatient.Id = result.Id; CurrentPatient.Name = result.Name; CurrentPatient.Age = result.Age; CurrentPatient.Gender = result.Gender; CurrentPatient.MaxGraph = result.MaxGraph; CurrentPatient.MinGraph = result.MinGraph; CurrentPatient.RateGraph = result.RateGraph; MainWindow.ChangePage("tracker"); } else { MessageBox.Show("Please insert correct data"); } } catch (Exception ex) { MessageBox.Show("A handled exception just occurred: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning); } }); }
/// <summary> /// Default constructor /// </summary> public SettingsViewModel() { DatabaseURL = FirebaseConfiguration.BasePathURL; DatabaseAuth = FirebaseConfiguration.AuthSecretCode; FirebaseConfiguration.UpdateConfig(); }