private void simpleButton1_Click(object sender, EventArgs e) { companeyName = textEdit1.Text; string Product = textEdit4.Text; CPUid cpu = new CPUid(companeyName + Product); cpu.KeyString = string.Empty; cpu.MixString = textEdit2.Text; textEdit3.Text = cpu.GetKeyString(); }
private void simpleButtonRegister_Click(object sender, EventArgs e) { _ProductName = textProduct.Text.Trim().ToUpper(); string isOnline = int.Parse(rgOnline.EditValue.ToString()) == 0 ? "" : "1"; if (rgCnnType.SelectedIndex == 0) { cpu = new CPUid(textCompanyName.Text + _ProductName + "SGDEMTOnline" + isOnline); } else if (rgCnnType.SelectedIndex == 1) { cpu = new CPUid(textCompanyName.Text + _ProductName + "SGDBPMOnline" + isOnline); } textEditMaskcode.Text = cpu.MixString; if (textCompanyName.Text == "SGD") { textEditValue.Text = cpu.KeyString; } cpu.KeyString = string.Empty; if (cpu == null) { return; } string key = cpu.GetKeyString(); //Registry.SetValue(H_KEY, "Structtmp", key); if (textEditValue.Text == key) { Registry.SetValue(H_KEY, "StructName", "CDT" + _ProductName.Substring(3, _ProductName.Length - 3)); Registry.SetValue(H_KEY, "CompanyName", textCompanyName.Text); Registry.SetValue(H_KEY, "RegisterNumber", textEditValue.Text); Registry.SetValue(H_KEY, "isDemo", 0); Registry.SetValue(H_KEY, "isOnline", int.Parse(rgOnline.EditValue.ToString())); Registry.SetValue(H_KEY, "SoftType", rgCnnType.SelectedIndex.ToString(), RegistryValueKind.DWord); if (tfbID.Text != "") { Registry.SetValue(H_KEY, "fbID", tfbID.Text); } this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Vui lòng liên hệ SGD soft để được đăng ký sử dụng!"); } }
private void simpleButtonRegister_Click(object sender, EventArgs e) { _ProductName = textProduct.Text.Trim().ToUpper(); cpu = new CPUid(textCompanyName.Text + _ProductName + "SGDEMTOnline"); textEditMaskcode.Text = cpu.MixString; if (textCompanyName.Text == "SGD") { textEditValue.Text = cpu.KeyString; } cpu.KeyString = string.Empty; if (cpu == null) { return; } string key = cpu.GetKeyString(); Registry.SetValue(H_KEY, "Structtmp", key); if (textEditValue.Text == key) { Registry.SetValue(H_KEY, "CompanyName", textCompanyName.Text); Registry.SetValue(H_KEY, "RegisterNumber", textEditValue.Text); Registry.SetValue(H_KEY, "isDemo", 0); this.DialogResult = DialogResult.OK; } else { if (sl == 10) { Registry.SetValue(H_KEY, "CompanyName", textCompanyName.Text); Registry.SetValue(H_KEY, "RegisterNumber", key); Registry.SetValue(H_KEY, "isDemo", 0); this.DialogResult = DialogResult.OK; } else { sl += 1; MessageBox.Show("Vui lòng liên hệ SGD soft để được đăng ký sử dụng!"); } } }