Beispiel #1
0
        private void Login()
        {
            if (ValidateLoginCode() == false)
                return;

            // request server
            string SYS_ADMIN = txtAdmin.Text;
            string SYS_PWD = txtPwd.Text;
            Task<String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
            () => {
                return service.SGMManager_ValidateAdminLogin(SYS_ADMIN, SYS_PWD);
            });
            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    this.Hide();
                    frmGSMMain.s_currentAdminDTO = dataResponse.ResponseDataSystemAdminDTO;
                    frmGSMMain a = new frmGSMMain();
                    a.ShowDialog();
                    this.Close();
                }
                else
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
            }, SynchronizationContext.Current);
        }
Beispiel #2
0
        private void Login()
        {
            if (ValidateLoginCode() == false)
            {
                return;
            }

            // request server
            string        SYS_ADMIN = txtAdmin.Text;
            string        SYS_PWD   = txtPwd.Text;
            Task <String> task      = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () => {
                return(service.SGMManager_ValidateAdminLogin(SYS_ADMIN, SYS_PWD));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    this.Hide();
                    frmGSMMain.s_currentAdminDTO = dataResponse.ResponseDataSystemAdminDTO;
                    frmGSMMain a = new frmGSMMain();
                    a.ShowDialog();
                    this.Close();
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }