checking in all the old panacean stuff
This commit is contained in:
201
ThirdParty/IntelliProtector/VS2010SampleNET (src)/VS2010SampleNET (src)/FormMain.cs
vendored
Normal file
201
ThirdParty/IntelliProtector/VS2010SampleNET (src)/VS2010SampleNET (src)/FormMain.cs
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// == How to test this example ==
|
||||
// 1. Build C# project (VS2010SampleNET)
|
||||
// 2. Protect the VS2010SampleNET.exe with IntelliProtector
|
||||
// 3. Start VS2010SampleNET.exe.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VS2010SampleNET
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnSortArray_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
SortArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Text);
|
||||
}
|
||||
}
|
||||
|
||||
[IntelliProtectorService.attributes.Encrypt]
|
||||
private void SortArray()
|
||||
{
|
||||
int[] array = new int[] { 10, 2, 3, 101, 3, 33, 7, 1 };
|
||||
Array.Sort(array);
|
||||
MessageBox.Show(@"Array is sorted");
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
UpdateControls();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateControls()
|
||||
{
|
||||
lIsProtected.Text = IntelliProtectorService.IntelliProtector.IsSoftwareProtected() ? "yes" : "no";
|
||||
lIsRegistered.Text = IntelliProtectorService.IntelliProtector.IsSoftwareRegistered() ? "yes" : "no";
|
||||
lTrialTimeUnitsTotal.Text = string.Format("{0} mins | {1} hours | {2} days | {3} weeks | {4} months"
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudMinutes)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudHours)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudDays)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudWeeks)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudMonths)
|
||||
);
|
||||
lLicenseType.Text = IntelliProtectorService.IntelliProtector.GetLicenseType().ToString();
|
||||
|
||||
int iDays = IntelliProtectorService.IntelliProtector.GetTrialDaysCount();
|
||||
lTrialDaysTotal.Text = iDays.ToString();
|
||||
|
||||
iDays = IntelliProtectorService.IntelliProtector.GetTrialDaysLeftCount();
|
||||
lTrialDaysLeft.Text = iDays.ToString();
|
||||
|
||||
iDays = IntelliProtectorService.IntelliProtector.GetLicenseExpirationDaysCount();
|
||||
lLicenseExpirationDaysTotal.Text = iDays.ToString();
|
||||
|
||||
iDays = IntelliProtectorService.IntelliProtector.GetLicenseExpirationDaysLeftCount();
|
||||
lLicenseExpirationDaysLeft.Text = iDays.ToString();
|
||||
|
||||
timerUpdateUnits_Tick(null, null);
|
||||
|
||||
lLaunchesTotal.Text = IntelliProtectorService.IntelliProtector.GetTrialLaunchesCount().ToString();
|
||||
lLaunchesLeft.Text = IntelliProtectorService.IntelliProtector.GetTrialLaunchesLeftCount().ToString();
|
||||
|
||||
const int ciMaxBufferLen = 256;
|
||||
StringBuilder stbBuffer = new StringBuilder(ciMaxBufferLen);
|
||||
|
||||
lBuyNowLink.Text = IntelliProtectorService.IntelliProtector.GetBuyNowLink();
|
||||
lRenewLicenseLink.Text = IntelliProtectorService.IntelliProtector.GetRenewalPurchaseLink();
|
||||
lCurrentPPVersion.Text = IntelliProtectorService.IntelliProtector.GetCurrentProductVersion();
|
||||
lSupportExpirationPPVersion.Text = IntelliProtectorService.IntelliProtector.GetSupportExpirationProductVersion();
|
||||
lLicenseCode.Text = IntelliProtectorService.IntelliProtector.GetLicenseCode();
|
||||
lCustomerName.Text = IntelliProtectorService.IntelliProtector.GetCustomerName();
|
||||
lCustomerEMail.Text = IntelliProtectorService.IntelliProtector.GetCustomerEMail();
|
||||
|
||||
lLicenseExpirationDaysTotal.Text = IntelliProtectorService.IntelliProtector.GetLicenseExpirationDaysCount().ToString();
|
||||
lLicenseExpirationDaysLeft.Text = IntelliProtectorService.IntelliProtector.GetLicenseExpirationDaysLeftCount().ToString();
|
||||
|
||||
lSupportExpirationDaysTotal.Text = IntelliProtectorService.IntelliProtector.GetSupportExpirationDaysCount().ToString();
|
||||
lSupportExpirationDaysLeft.Text = IntelliProtectorService.IntelliProtector.GetSupportExpirationDaysLeftCount().ToString();
|
||||
|
||||
DateTime dtOrder = IntelliProtectorService.IntelliProtector.GetOrderDate();
|
||||
ShowDate(lOrderDate, dtOrder);
|
||||
|
||||
DateTime dtCurrentActivationDate = IntelliProtectorService.IntelliProtector.GetCurrentActivationDate();
|
||||
ShowDate(lCurrentActivationDate, dtCurrentActivationDate);
|
||||
|
||||
DateTime dtFirstRegistrationDate = IntelliProtectorService.IntelliProtector.GetFirstRegistrationDate();
|
||||
ShowDate(lFirstRegistrationDate, dtFirstRegistrationDate);
|
||||
|
||||
DateTime dtCurrentRegistrationDate = IntelliProtectorService.IntelliProtector.GetCurrentRegistrationDate();
|
||||
ShowDate(lCurrentRegistrationDate, dtCurrentRegistrationDate);
|
||||
|
||||
DateTime dtProtectionDate = IntelliProtectorService.IntelliProtector.GetProtectionDate();
|
||||
ShowDate(lProtectionDate, dtProtectionDate);
|
||||
|
||||
DateTime dtLicenseExpirationDate = IntelliProtectorService.IntelliProtector.GetLicenseExpirationDate();
|
||||
ShowDate(lLicenseExpirationDate, dtLicenseExpirationDate);
|
||||
|
||||
DateTime dtSupportExpirationDate = IntelliProtectorService.IntelliProtector.GetSupportExpirationDate();
|
||||
ShowDate(lSupportExpirationDate, dtSupportExpirationDate);
|
||||
|
||||
lIntelliProtectorVersion.Text = IntelliProtectorService.IntelliProtector.GetIntelliProtectorVersion();
|
||||
}
|
||||
|
||||
private static void ShowDate(Control label, DateTime dt)
|
||||
{
|
||||
label.Text = (dt != DateTime.MinValue) ? string.Format("{0}.{1}.{2} {3}:{4}", dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute) : "Not applicable";
|
||||
}
|
||||
|
||||
private void timerUpdateUnits_Tick(object sender, EventArgs e)
|
||||
{
|
||||
lTrialTimeUnitsLeft.Text = string.Format("{0} mins | {1} hours | {2} days | {3} weeks | {4} months"
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsLeftCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudMinutes)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsLeftCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudHours)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsLeftCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudDays)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsLeftCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudWeeks)
|
||||
, IntelliProtectorService.IntelliProtector.GetTrialUnitsLeftCount((int)IntelliProtectorService.IntelliProtector.enUnitDimension.eudMonths)
|
||||
);
|
||||
}
|
||||
|
||||
private void btnShowRegistation_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
IntelliProtectorService.IntelliProtector.ShowRegistrationWindow();
|
||||
UpdateControls();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRegister_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
IntelliProtectorService.IntelliProtector.RegisterSoftware(tbLicenseCode.Text);
|
||||
UpdateControls();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRenew_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
IntelliProtectorService.IntelliProtector.RenewLicenseCode(tbRenewalCode.Text);
|
||||
UpdateControls();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRegistrationByEmail_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (FormRegistrationByEmail regByEmail = new FormRegistrationByEmail("VS2010 CS sample.dat"))
|
||||
regByEmail.ShowDialog();
|
||||
|
||||
UpdateControls();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user