private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (txtFirstName.Text.Length < 2)
            {
                lblInfo.Text = "Missing firstname";
            }
            if (txtLastName.Text.Length < 2)
            {
                lblInfo.Text = "Missing lastname";
            }
            if (txtCompany.Text.Length < 2)
            {
                lblInfo.Text = "Missing company";
            }

            _registrationData = new RegistrationDataModel
            {
                FirstName  = this.txtFirstName.Text,
                LastName   = this.txtLastName.Text,
                Company    = this.txtCompany.Text,
                ComputerId = SysInfoManager.GetComputerId()
            };

            _registrationDataManager = RegistrationDataManager.Create(_registrationData);
            txtLicenseRequest.Text   = _registrationDataManager.SerializeToString();
        }
Пример #2
0
        private void FormAbout_Load(object sender, EventArgs e)
        {
            Text = $"About {AssemblyTitle}";
            labelProductName.Text   = AssemblyProduct;
            labelVersion.Text       = $"Version {AssemblyVersion}";
            labelCopyright.Text     = AssemblyCopyright;
            labelCompanyName.Text   = AssemblyCompany;
            textBoxDescription.Text = AssemblyDescription;

            var licenseData = new LicenseDataModel {
                RegistrationData = new RegistrationDataModel {
                    ComputerId = SysInfoManager.GetComputerId()
                }
            };

            licenseInfoControl1.InitLicenseData(licenseData);
            licenseInfoControl1.CreateRequest = ShowLicenseRequestForm;
        }
Пример #3
0
        //[TestMethod]
        public void TestGenerateLicenseRequest()
        {
            var registrationData = new RegistrationDataModel
            {
                FirstName   = Resources.RegFirstName,
                LastName    = Resources.RegLastName,
                Company     = Resources.RegCompany,
                ComputerId  = SysInfoManager.GetComputerId(),
                ValidTo     = DateTime.Today.AddYears(2),
                VersionName = "Secure memo",
            };

            var    registrationDataManager = RegistrationDataManager.Create(registrationData);
            string licenseRequestString    = registrationDataManager.SerializeToString();

            // SaveDatabase to file
            FileStream fs = null;

            try
            {
                fs = File.Create(LicenseReqFilename);
                StreamWriter sw = new StreamWriter(fs);
                sw.Write(licenseRequestString);
                sw.Flush();
                fs.Flush(true);
            }
            catch (Exception exception)
            {
                Assert.Fail(exception.Message);
            }
            finally
            {
                fs?.Close();
            }

            Assert.IsTrue(File.Exists(LicenseReqFilename), "License request file was not generated");

            //System.Diagnostics.Process.Start(LicenseReqFilename);
        }
Пример #4
0
 public void GetSystemInfo()
 {
     var sysInfo = SysInfoManager.GetComputerId();
 }