BigLitho/Large.Lito.Database/Make3_Treko3D/ChildForms/CopyProtectionSettings.cs

91 lines
3.7 KiB
C#

using System;
using System.Windows.Forms;
using ClassLibrary.Security;
namespace ChildForms
{
public partial class CopyProtectionSettings : UserControl
{
public CopyProtectionSettings()
{
InitializeComponent();
}
private void btnGenLicense_Click(object sender, EventArgs e)
{
string userName = txtUserName.Text;
DateTime startDate = dateTimeStartDate.Value;
DateTime endDate = dateTimeEndDate.Value;
bool licExpired = chckExpired.Checked;
bool licTreko = chckTreko.Checked;
bool licTreko3D = chckTreko3D.Checked;
LicenseAuthorization.SaveTestLicense(userName, startDate, endDate, licExpired, licTreko, licTreko3D);
txtProductName.Text = LicenseAuthorization.ProductName;
txtUserName.Text = LicenseAuthorization.UserName;
dateTimeStartDate.Value = LicenseAuthorization.StartDate;
dateTimeEndDate.Value = LicenseAuthorization.EndDate;
txtCPU.Text = FingerPrint.CPU;
txtBios.Text = FingerPrint.BIOS;
txtBase.Text = FingerPrint.Base;
txtFingerPrint.Text = FingerPrint.Value();
}
private void btnTestLicense_Click(object sender, EventArgs e)
{
string fingerprint = FingerPrint.Value();
if (LicenseAuthorization.TestTestLicense() == true)
{
txtProductName.Text = LicenseAuthorization.ProductName;
txtUserName.Text = LicenseAuthorization.UserName;
dateTimeStartDate.Value = LicenseAuthorization.StartDate;
dateTimeEndDate.Value = LicenseAuthorization.EndDate;
txtCPU.Text = FingerPrint.CPU;
txtBios.Text = FingerPrint.BIOS;
txtBase.Text = FingerPrint.Base;
txtFingerPrint.Text = LicenseAuthorization.Fingerprint;
chckExpired.Checked = LicenseAuthorization.Expired;
chckTreko.Checked = LicenseAuthorization.Treko;
chckTreko3D.Checked = LicenseAuthorization.Treko3D;
}
}
private void btnGenDefaultLic_Click(object sender, EventArgs e)
{
LicenseAuthorization.SaveDefaultLicense();
txtProductName.Text = LicenseAuthorization.ProductName;
txtUserName.Text = LicenseAuthorization.UserName;
dateTimeStartDate.Value = LicenseAuthorization.StartDate;
dateTimeEndDate.Value = LicenseAuthorization.EndDate;
txtCPU.Text = FingerPrint.CPU;
txtBios.Text = FingerPrint.BIOS;
txtBase.Text = FingerPrint.Base;
txtFingerPrint.Text = FingerPrint.Default();
}
private void btnUpdateLicense_Click(object sender, EventArgs e)
{
string userName = txtUserName.Text;
DateTime startDate = dateTimeStartDate.Value;
DateTime endDate = dateTimeEndDate.Value;
bool licExpired = chckExpired.Checked;
bool licTreko = chckTreko.Checked;
bool licTreko3D = chckTreko3D.Checked;
LicenseAuthorization.SaveTestLicense(userName, startDate, endDate, licExpired, licTreko, licTreko3D);
txtProductName.Text = LicenseAuthorization.ProductName;
txtUserName.Text = LicenseAuthorization.UserName;
dateTimeStartDate.Value = LicenseAuthorization.StartDate;
dateTimeEndDate.Value = LicenseAuthorization.EndDate;
txtCPU.Text = FingerPrint.CPU;
txtBios.Text = FingerPrint.BIOS;
txtBase.Text = FingerPrint.Base;
txtFingerPrint.Text = FingerPrint.Value();
}
}
}