private void RegisterDialog_Load(object sender, EventArgs e) { this.BindingControlEventHandler(); DriveInformation drv = Licensing.GetDriveInfo(); this.GetSrvRegData(); this.lblSN.Text = RegisterDialog.ReadSernum(); this.lblMachineCode.Text = Licensing.GetHDDSerialNumber(Licensing.GetSystemDriveLetter()); }
private void GetSrvRegData() { this.srv_regdata = Licensing.GetSrvRegisterData(RegisterDialog.ReadSernum(), Licensing.GetHDDSerialNumber(Licensing.GetSystemDriveLetter())); }
private void btnReloadStatus_Click(object sender, EventArgs e) { LoadingScreen ls = new LoadingScreen(); ls.ShowCenterParent(this); SRV_RegisterData srv_regdata = null; bool is_connected = false; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += delegate { if (!Licensing.IsServerConnected()) { is_connected = false; } else { is_connected = true; } //if ((Licensing.IsLAN() && Licensing.IsServer()) || !Licensing.IsLAN()) //{ //srv_regdata = Licensing.GetSrvRegisterData(Licensing.GetLocalRegData()); srv_regdata = Licensing.GetSrvRegisterData(RegisterDialog.ReadSernum(), Licensing.GetHDDSerialNumber(Licensing.GetSystemDriveLetter())); //} //System.Threading.Thread.Sleep(500); }; worker.RunWorkerCompleted += delegate { ls.Close(); if (!is_connected) { MessageBox.Show("ไม่สามารถติดต่อกับเซิร์ฟเวอร์ได้, กรุณาตรวจสอบการเชื่อมต่ออินเทอร์เน็ต", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (srv_regdata == null) { this.register_status = Licensing.STATUS.NOT_REGISTER; } else { if (srv_regdata.status_code == ((int)Licensing.STATUS.NOT_REGISTER).ToString()) { this.register_status = Licensing.STATUS.NOT_REGISTER; } if (srv_regdata.status_code == ((int)Licensing.STATUS.WAIT_FOR_VERIFY).ToString()) { this.register_status = Licensing.STATUS.WAIT_FOR_VERIFY; } if (srv_regdata.status_code == ((int)Licensing.STATUS.REGISTERED).ToString()) { this.register_status = Licensing.STATUS.REGISTERED; } } this.RepaintStatusPanel(); this.SetControlState(); }; worker.RunWorkerAsync(); }