示例#1
0
        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;
            }
        }
        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;
            }
        }