private void cmdOK_Click(object sender, System.EventArgs e) { if (AddinAppData.Instance.Key != txtKey.Text) { txtKey.Text = txtKey.Text.Trim(); if (!ValidateRegistrationKey(txtKey.Text)) { MessageBox.Show("The entered key is not valid.", "Invalid Key!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (chkStat.Checked != AddinAppData.Instance.AllowStats) { try { var service = new nhydrateservice.MainService(); service.ResetStatistics(AddinAppData.Instance.Key, chkStat.Checked); } catch (Exception ex) { //Do Nothing } } AddinAppData.Instance.AllowStats = chkStat.Checked; AddinAppData.Instance.Key = txtKey.Text; AddinAppData.Instance.Save(); } this.DialogResult = DialogResult.OK; this.Close(); }
private void cmdLogin_Click(object sender, System.EventArgs e) { try { nhydrateservice.MainService service = null; service = new nhydrateservice.MainService(); if (service.AuthenticateUser2(txtLoginEMail.Text, txtLoginPassword.Text, SecurityHelper.GetMachineID())) { service.ResetStatistics(txtLoginEMail.Text, chkStat.Checked); var key = service.GetKey(txtLoginEMail.Text); AddinAppData.Instance.Key = key; AddinAppData.Instance.AllowStats = chkStat.Checked; AddinAppData.Instance.Save(); MessageBox.Show("There login has been validated. Your key has been verified.", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("There login could not be validated.", "Invalid Login!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("There was an error trying to register. Please visit the main nHydrate site to register: http://www.nHydrate.org.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public static bool CanConnect() { nhydrateservice.MainService service = null; try { service = new nhydrateservice.MainService(); return service.IsLive(); } catch (Exception ex) { return false; } }
public static bool CanConnect() { nhydrateservice.MainService service = null; try { service = new nhydrateservice.MainService(); return(service.IsLive()); } catch (Exception ex) { return(false); } }
public static string GetLatestVersion() { nhydrateservice.MainService service = null; try { service = new nhydrateservice.MainService(); var version = service.GetLatestVersion3(AddinAppData.Instance.Key, GetCurrentVersion()); return version.Version; } catch (Exception ex) { return "(Unknown)"; } }
public static string GetLatestVersion() { nhydrateservice.MainService service = null; try { service = new nhydrateservice.MainService(); var version = service.GetLatestVersion3(AddinAppData.Instance.Key, GetCurrentVersion()); return(version.Version); } catch (Exception ex) { return("(Unknown)"); } }
private void cmdOK_Click(object sender, System.EventArgs e) { txtFirstName.Text = txtFirstName.Text.Trim(); txtLastName.Text = txtLastName.Text.Trim(); txtEmail.Text = txtEmail.Text.Trim(); txtPassword.Text = txtPassword.Text.Trim(); if (txtFirstName.Text == string.Empty) { MessageBox.Show("The first name is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (txtLastName.Text == string.Empty) { MessageBox.Show("The last name is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (cboCountry.SelectedIndex == 0) { MessageBox.Show("The country is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (txtEmail.Text == string.Empty) { MessageBox.Show("The email is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (txtPassword.Text == string.Empty) { MessageBox.Show("The password is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (txtPassword.Text != txtVerify.Text) { MessageBox.Show("The password must be verified.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var message = string.Empty; nhydrateservice.MainService service = null; try { service = new nhydrateservice.MainService(); var document = new XmlDocument(); document.LoadXml("<a></a>"); XmlHelper.AddElement(document.DocumentElement, "firstname", txtFirstName.Text); XmlHelper.AddElement(document.DocumentElement, "lastname", txtLastName.Text); XmlHelper.AddElement(document.DocumentElement, "city", txtCity.Text); XmlHelper.AddElement(document.DocumentElement, "region", txtRegion.Text); XmlHelper.AddElement(document.DocumentElement, "postcode", txtPostalCode.Text); XmlHelper.AddElement(document.DocumentElement, "country", cboCountry.SelectedItem.ToString()); XmlHelper.AddElement(document.DocumentElement, "email", txtEmail.Text); XmlHelper.AddElement(document.DocumentElement, "password", txtPassword.Text); XmlHelper.AddElement(document.DocumentElement, "machinekey", SecurityHelper.GetMachineID()); XmlHelper.AddElement(document.DocumentElement, "version", VersionHelper.GetCurrentVersion()); XmlHelper.AddElement(document.DocumentElement, "allowstats", chkStat.Checked.ToString().ToLower()); message = service.RegisterUser2(document.OuterXml); } catch (Exception ex) { MessageBox.Show("There was an error trying to register. Please visit the main nHydrate site to register: http://www.nHydrate.org.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!string.IsNullOrEmpty(message)) { MessageBox.Show(message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var key = string.Empty; try { key = service.GetKey(txtEmail.Text); } catch (Exception ex) { MessageBox.Show("There was an error trying to retrieve the key. Please visit the main nHydrate site to register: http://www.nHydrate.org.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AddinAppData.Instance.Key = key; AddinAppData.Instance.AllowStats = chkStat.Checked; AddinAppData.Instance.Save(); this.DialogResult = DialogResult.OK; this.Close(); }