|
|
@@ -33,12 +33,55 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
|
|
|
DateTime m_oExpireData;
|
|
|
|
|
|
+ bool m_bAdd;
|
|
|
+
|
|
|
COTSLicenseInfo m_pLicenseInfo;
|
|
|
public DlgLicenseInfo()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ public bool ShowEditDialog(COTSLicenseInfo a_oLicenseInfo, bool a_bAdd /*= FALSE*/, bool a_bRequest /*= FALSE*/)
|
|
|
+ {
|
|
|
+ COTSLicenseInfo pLicenseInfo=new COTSLicenseInfo(a_oLicenseInfo);
|
|
|
+
|
|
|
+ // AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
|
|
+ DlgLicenseInfo dlg = new DlgLicenseInfo();
|
|
|
+ dlg.SetLicenseInfo(pLicenseInfo);
|
|
|
+ if (a_bAdd)
|
|
|
+ {
|
|
|
+ dlg.SetAddSwitch();
|
|
|
+ }
|
|
|
+ else if (a_bRequest)
|
|
|
+ {
|
|
|
+ dlg.SetRequestSwitch();
|
|
|
+ }
|
|
|
+ if (dlg.ShowDialog() == DialogResult.OK)
|
|
|
+
|
|
|
+ {
|
|
|
+ a_oLicenseInfo = pLicenseInfo;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void SetAddSwitch() { m_bAdd = true; }
|
|
|
+ public void SetRequestSwitch() { m_bRequest = true; }
|
|
|
+
|
|
|
+ // set license info
|
|
|
+ public void SetLicenseInfo(COTSLicenseInfo a_pLicenseInfo)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ if (a_pLicenseInfo!=null)
|
|
|
+ {
|
|
|
+ m_pLicenseInfo = a_pLicenseInfo;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void OnEnChangeEditNickname(object sender, EventArgs e)
|
|
|
{
|
|
|
UpdateControlStatus(false);
|
|
|
@@ -131,10 +174,10 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
|
|
|
// try to load license info from a text file
|
|
|
COTSLicenseInfo pOTSLicenseInfo = COTSLicMgr::LoadLicenseInfoFromTextFile(strPathName);
|
|
|
- kkkk
|
|
|
+
|
|
|
|
|
|
// set control data with the license info
|
|
|
- if (pOTSLicenseInfo)
|
|
|
+ if (pOTSLicenseInfo!=null)
|
|
|
{
|
|
|
SetControlData(pOTSLicenseInfo);
|
|
|
|
|
|
@@ -201,7 +244,32 @@ namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
|
|
|
private void OnBnClickedOk(object sender, EventArgs e)
|
|
|
{
|
|
|
+ // dialog is from request call
|
|
|
+ if (m_bRequest)
|
|
|
+ {
|
|
|
+ // get control data from dialog
|
|
|
+ UpdateData();
|
|
|
+
|
|
|
+ // create a license info
|
|
|
+ COTSLicenseInfo a_pOTSLicenseInfo = new COTSLicenseInfo();
|
|
|
+ a_pOTSLicenseInfo.SetComputerNickName(m_strEditComputerNickName);
|
|
|
+ a_pOTSLicenseInfo.SetMachineId(m_strEditMachineId);
|
|
|
+ a_pOTSLicenseInfo.SetPackId((COTSLicenseInfo.OTS_SOFT_PACKAGE_ID)m_nComboSoftPackId);
|
|
|
+ a_pOTSLicenseInfo.SetLicType((COTSLicenseInfo.OTS_LICENSE_TYPE)m_nCombeLicenseType);
|
|
|
+ a_pOTSLicenseInfo.SetExpireDate(m_oExpireData);
|
|
|
+
|
|
|
+ //create license info text file
|
|
|
+ if (!COTSLicMgr::CreateLicenseInfoFileText(a_pOTSLicenseInfo))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // get control data for the license info
|
|
|
+ GetControlData(!m_bRequest);
|
|
|
|
|
|
+ // close dialog, DoModel() return IDOK
|
|
|
+ // CDialog::OnOK();
|
|
|
}
|
|
|
|
|
|
// update control status
|