private void btnDialogOk_Click(object sender, RoutedEventArgs e) { try { _user = App.WimeaApp.Users.Add(); //(string id, string name, string email, string contact, string role, string station) _user.Update(Id, nameTxtBx.Text, emailTxtBx.Text, contactTxtBx.Text, roleTxtBx.Text, stationTxtCbx.Text); this.DialogResult = true; } catch (Exception ex){ MessageBox.Show(ex.Message.ToString()); } }
private void btnDialogOk_Click(object sender, RoutedEventArgs e) { try { _user = App.WimeaApp.Users.Add(); _user.Name = nameTxtBx.Text; _user.Email = emailTxtBx.Text; _user.Contact = contactTxtBx.Text; _user.Role = roleTxtBx.Text; _user.Station = stationTxtCbx.Text; _user.Save(); this.DialogResult = true; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); return; } }
private string Loading_users() { try { string total = ""; string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + "center-" + "users" + ".json"); foreach (string line in lines) { total += line; } List<User> model = JsonConvert.DeserializeObject<List<User>>(total); for (int d = 0; d < model.Count; d++) { r = App.WimeaApp.Users.Add(); r.Station = model.ElementAt(d).Station; r.Name = model.ElementAt(d).Name; r.Email = model.ElementAt(d).Email; r.Contact = model.ElementAt(d).Contact; r.Role = model.ElementAt(d).Role; r.Password = Encryption.SimpleEncrypt(model.ElementAt(d).Password); r.Sync = "T"; r.Save(); } return "Loaded synoptic information into local database!"; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); return "done loading metars"; } }
private string Loading_users() { //string reply = ""; //try //{ string total = ""; string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + "center-" + "users" + ".json"); foreach (string line in lines) { total += line; } List<User> model = JsonConvert.DeserializeObject<List<User>>(total); for (int d = 0; d < model.Count; d++) { try { string usernames = _UsersList.Where(l => l.Email == model.ElementAt(d).Email).Select(l => l.Name).SingleOrDefault().ToString(); if (usernames == "") { r = new User(null); r.Station = "Data center"; r.Name = model.ElementAt(d).Name; r.Email = model.ElementAt(d).Email; r.Contact = model.ElementAt(d).Contact; r.Role = model.ElementAt(d).Role; r.Save(); } } catch (Exception) { r = new User(null); r.Station = "Data center"; r.Name = model.ElementAt(d).Name; r.Email = model.ElementAt(d).Email; r.Contact = model.ElementAt(d).Contact; r.Role = model.ElementAt(d).Role; r.Save(); } } return "Loaded synoptic information into local database!"; //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message.ToString()); // return "done loading metars"; //} }
private void sync_Click(object sender, RoutedEventArgs e) { if (Sending.IsInternetAvailable()) { r = new User(null) ; r.Deleteall(); // r.Save(); bw.RunWorkerAsync(); bw.WorkerReportsProgress = true; bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); } else { this.lblName.Text = ("No internet connection"); } }