private void buttonLoginLogout_Click(object sender, EventArgs e)
        {
            if (Variables.myStatus != HaspStatus.StatusOk)
            {
                if (Variables.connectToSpecifyKeyId == true && !String.IsNullOrEmpty(Variables.specifyKeyId))
                {
                    Variables.myStatus = Variables.myHasp.Login(Variables.vendorCode[Variables.vendorCode.Keys.Where(k => k.Key == Variables.currentBatchCode).FirstOrDefault()], Variables.scopeForSpecificKeyId.Replace("{KEY_ID}", Variables.specifyKeyId));
                }
                else
                {
                    Variables.myStatus = Variables.myHasp.Login(Variables.vendorCode[Variables.vendorCode.Keys.Where(k => k.Key == Variables.currentBatchCode).FirstOrDefault()], Variables.scopeForLocal);

                    if (Variables.myStatus != HaspStatus.StatusOk)
                    {
                        Variables.myStatus = Variables.myHasp.Login(Variables.vendorCode[Variables.vendorCode.Keys.Where(k => k.Key == Variables.currentBatchCode).FirstOrDefault()]);
                    }
                }

                if (Variables.myStatus == HaspStatus.StatusOk)
                {
                    buttonLoginLogout.Text = MultiLanguage.ErrorMessageReplacer(language.Key, "Logout");
                    keyInfo                   = XDocument.Parse(MyGlobalMethods.GetSessionInfo("<haspformat format=\"keyinfo\"/>"));
                    productInfo               = XDocument.Parse(MyGlobalMethods.GetSessionInfo(Variables.formatForGetProductId));
                    featureInfo               = XDocument.Parse(MyGlobalMethods.GetSessionInfo(Variables.formatForGetFeatureId));
                    parentKeyId               = keyInfo.Descendants().FirstOrDefault(p => p.Name.LocalName == "haspid").Value;
                    productId                 = productInfo.Descendants().FirstOrDefault(p => p.Name.LocalName == "id").Value;
                    productName               = productInfo.Descendants().FirstOrDefault(p => p.Name.LocalName == "name").Value;
                    featureId                 = featureInfo.Descendants().FirstOrDefault(f => f.Name.LocalName == "id").Value;
                    featureName               = featureInfo.Descendants().FirstOrDefault(f => f.Name.LocalName == "name").Value;
                    linkLabelKeyInfo.Text     = parentKeyId;
                    linkLabelLicenseInfo.Text = productName + " -> " + featureName + " (FID: " + featureId + ")";
                    labelLoginStatusCode.Text = Variables.myStatus.ToString();

                    if (keyInfo.Descendants().Where(p => p.Name.LocalName == "address").Count() > 0)
                    {
                        labelNumberOfDaysForDetach.Enabled = true;
                        numericUpDownDaysForDetach.Enabled = true;
                        buttonDetach.Enabled       = true;
                        buttonCancelDetach.Enabled = false;
                    }
                    else
                    {
                        labelNumberOfDaysForDetach.Enabled = false;
                        numericUpDownDaysForDetach.Enabled = false;
                        buttonDetach.Enabled       = false;
                        buttonCancelDetach.Enabled = true;
                    }

                    labelIntro.Text                      = MultiLanguage.ErrorMessageReplacer(language.Key, "Login successfully!");
                    labelIntro.ForeColor                 = Color.Green;
                    pictureBoxLike.Visible               = true;
                    pictureBoxDislike.Visible            = false;
                    panelMain.Enabled                    = true;
                    labelLoginStatus.Enabled             = true;
                    labelLoginStatusCode.Enabled         = true;
                    labelCurrentLicense.Enabled          = true;
                    linkLabelLicenseInfo.Enabled         = true;
                    labelKeyInfo.Enabled                 = true;
                    linkLabelKeyInfo.Enabled             = true;
                    buttonCheckAvailableLicenses.Enabled = false;
                    sForm.labelLanguage.Enabled          = false;
                    sForm.comboBoxSelectLanguage.Enabled = false;
                    sForm.labelSelectBatchCode.Enabled   = false;
                    sForm.comboBoxBatchCode.Enabled      = false;
                    sForm.labelAddNewBatchCode.Enabled   = false;
                    sForm.textBoxAddNewBatchCode.Enabled = false;
                    sForm.buttonAddNewBatchCode.Enabled  = false;
                    sForm.buttonDeleteBatchCode.Enabled  = false;
                    sForm.labelFeatureIdForUsing.Enabled = false;
                    sForm.numericUpDownFeatureId.Enabled = false;
                }
                else
                {
                    labelLoginStatusCode.Text = Variables.myStatus.ToString();
                    labelIntro.Text           = MultiLanguage.ErrorMessageReplacer(language.Key, "Please login first!");
                    labelIntro.ForeColor      = Color.Black;
                    panelMain.Enabled         = false;
                    pictureBoxLike.Visible    = false;
                    pictureBoxDislike.Visible = true;
                }
            }
            else
            {
                Variables.myStatus                   = Variables.myHasp.Logout();
                Variables.myStatus                   = HaspStatus.AlreadyLoggedOut;
                buttonLoginLogout.Text               = MultiLanguage.ErrorMessageReplacer(language.Key, "Login");
                labelIntro.Text                      = MultiLanguage.ErrorMessageReplacer(language.Key, "Please login first!");
                linkLabelLicenseInfo.Text            = "...";
                linkLabelKeyInfo.Text                = "...";
                labelLoginStatusCode.Text            = "...";
                textBoxSourceText.Text               = "";
                textBoxResult.Text                   = "";
                labelIntro.ForeColor                 = Color.Black;
                panelMain.Enabled                    = false;
                pictureBoxLike.Visible               = false;
                pictureBoxDislike.Visible            = false;
                labelNumberOfDaysForDetach.Enabled   = false;
                numericUpDownDaysForDetach.Value     = 0;
                numericUpDownDaysForDetach.Enabled   = true;
                buttonDetach.Enabled                 = false;
                buttonCancelDetach.Enabled           = false;
                labelLoginStatus.Enabled             = false;
                labelLoginStatusCode.Enabled         = false;
                labelCurrentLicense.Enabled          = false;
                linkLabelLicenseInfo.Enabled         = false;
                labelKeyInfo.Enabled                 = false;
                linkLabelKeyInfo.Enabled             = false;
                buttonCheckAvailableLicenses.Enabled = true;
                sForm.labelLanguage.Enabled          = true;
                sForm.comboBoxSelectLanguage.Enabled = true;
                sForm.labelSelectBatchCode.Enabled   = true;
                sForm.comboBoxBatchCode.Enabled      = true;
                sForm.labelAddNewBatchCode.Enabled   = true;
                sForm.textBoxAddNewBatchCode.Enabled = true;
                sForm.buttonAddNewBatchCode.Enabled  = !String.IsNullOrEmpty(sForm.textBoxAddNewBatchCode.Text) ? true : false;
                sForm.buttonDeleteBatchCode.Enabled  = (sForm.comboBoxBatchCode.SelectedItem.ToString() != "DEMOMA") ? true : false;
                sForm.labelFeatureIdForUsing.Enabled = true;
                sForm.numericUpDownFeatureId.Enabled = true;
            }
        }
 private void linkLabelKeyInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     MessageBox.Show(MyGlobalMethods.GetSessionInfo("<haspformat format=\"keyinfo\"/>"), MultiLanguage.ErrorMessageReplacer(language.Key, "Key Info"));
 }