GetCurrentVersion() public static method

public static GetCurrentVersion ( ) : string
return string
Exemplo n.º 1
0
 private void cmdCheckUpdate_Click(object sender, System.EventArgs e)
 {
     //Check for latest version
     if (VersionHelper.CanConnect())
     {
         if (VersionHelper.NeedUpdate(VersionHelper.GetLatestVersion()))
         {
             MessageBox.Show("The version of nHydrate you are using is " + VersionHelper.GetCurrentVersion() + ". There is a newer version available " + VersionHelper.GetLatestVersion() + ". Download the latest version at http://nHydrate.CodePlex.com.", "New Version Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("This is the latest version.", "Version Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("There was an error trying to connect to the server.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        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();
        }