private void ConfigureUI()
        {
            if (tabControlFuncionalities.InvokeRequired)
            {
                ConfigureUICallBack d = new ConfigureUICallBack(ConfigureUI);
                this.Invoke(d, null);
            }
            else
            {
                switch (_appState)
                {
                    case AppState.BeforeLogin:
                        {
                            HideTabPages();
                            btnClear.Enabled = textboxPublicKey.Enabled = textBoxPrivateKey.Enabled = true;
                            textboxPublicKey.Text = textBoxPrivateKey.Text = string.Empty;
                            lblFieldEmptyPublicKey.Visible = lblFieldEmptyPrivateKey.Visible = false;
                            btnOrder.Enabled = _tierClicked = false;
                            _wordCount = 0;
                            btnLogIn.Text = Properties.Resources.LogIn;
                            lbCredits.Text = "?";
                            ShowCredits(false);
                            btnRefresh.Enabled = false;

                            break;
                        }
                    case AppState.Logging:
                        {
                            ShowLoading();
                            //Deshabiltando controles visuales
                            btnLogIn.Enabled = btnClear.Enabled = textboxPublicKey.Enabled = textBoxPrivateKey.Enabled = false;
                            break;
                        }
                    case AppState.AfterLogin:
                        {
                            ShowTabPages(new List<TabPage>() { tabPageOrder, tabPageOverview });
                            tabControlFuncionalities.SelectedTab = tabPageOverview;

                            btnLogIn.Enabled = true;
                            btnLogIn.Text = Properties.Resources.LogOf;
                            btnRefresh.Enabled = true;
                            break;

                        }
                    case AppState.ErrorLogin:
                        {
                            _appState = AppState.BeforeLogin;
                            ConfigureUI();

                            break;
                        }
                    case AppState.Ordering:
                        {
                            #region Deshabiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = false;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = false;

                            //Tab Overview
                            jobsViewer1.Enabled = false;

                            //Tab View
                            panelView.Enabled = false;

                            //Tab Review
                            panelReview.Enabled = false;

                            //Tab Reject
                            panelReject.Enabled = false;

                            //Tab Correct
                            panelCorrect.Enabled = false;

                            #endregion

                            HideNotification();
                            ShowLoading();
                            break;
                        }
                    case AppState.AfterOrder:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //Tab View
                            panelView.Enabled = true;

                            //Tab Review
                            panelReview.Enabled = true;

                            //Tab Reject
                            panelReject.Enabled = true;

                            //Tab Correct
                            panelCorrect.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            #endregion

                            ShowNotification(Properties.Resources.TEXT_INFO_ORDER_OK, ENotificationType.Success);
                            ClearJobTab();
                            break;
                        }
                    case AppState.ErrorOrdering:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //Tab View
                            panelView.Enabled = true;

                            //Tab Review
                            panelReview.Enabled = true;

                            //Tab Reject
                            panelReject.Enabled = true;

                            //Tab Correct
                            panelCorrect.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            #endregion

                            ClearJobTab();

                            break;
                        }
                    case AppState.Canceling:
                        {
                            #region Deshabiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = false;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = false;

                            //Tab Overview
                            jobsViewer1.Enabled = false;

                            //Tab View
                            panelView.Enabled = false;

                            //Tab Review
                            panelReview.Enabled = false;

                            //Tab Reject
                            panelReject.Enabled = false;

                            //Tab Correct
                            panelCorrect.Enabled = false;

                            #endregion

                            HideNotification();
                            ShowLoading();
                            break;
                        }
                    case AppState.AfterCancel:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //Tab View
                            panelView.Enabled = true;

                            //Tab Review
                            panelReview.Enabled = true;

                            //Tab Reject
                            panelReject.Enabled = true;

                            //Tab Correct
                            panelCorrect.Enabled = true;

                            #endregion

                            ShowNotification(Properties.Resources.TEXT_INFO_CANCEL_OK, ENotificationType.Success);

                            //
                            UpdateJobState();

                            _selectedJob = null;

                            break;
                        }
                    case AppState.ErrorCanceling:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //Tab View
                            panelView.Enabled = true;

                            //Tab Review
                            panelReview.Enabled = true;

                            //Tab Reject
                            panelReject.Enabled = true;

                            //Tab Correct
                            panelCorrect.Enabled = true;

                            #endregion

                            _selectedJob = null;

                            break;
                        }
                    case AppState.Viewing:
                        {
                            #region Deshabiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = false;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = false;

                            //Tab Overview
                            jobsViewer1.Enabled = false;

                            //Tab View
                            panelView.Enabled = false;

                            //Tab Review
                            tabControlFuncionalities.TabPages.Remove(tabPageReview);

                            //Tab Reject
                            tabControlFuncionalities.TabPages.Remove(tabPageReject);

                            //Tab Correct
                            tabControlFuncionalities.TabPages.Remove(tabPageRequestCorrection);

                            #endregion

                            HideNotification();
                            ShowLoading();
                            break;
                        }
                    case AppState.AfterView:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //Tab View
                            panelView.Enabled = true;
                            if (!tabControlFuncionalities.TabPages.Contains(tabPageView))
                                tabControlFuncionalities.TabPages.Add(tabPageView);

                            tabControlFuncionalities.SelectedTab = tabPageView;

                            #endregion

                            ShowNotification(Properties.Resources.TEXT_INFO_VIEW_OK, ENotificationType.Success);

                            break;
                        }
                    case AppState.ErrorViewing:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            #endregion

                            break;
                        }
                    case AppState.Reviewing:
                        {
                            #region Deshabiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = false;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = false;

                            //Tab Overview
                            jobsViewer1.Enabled = false;

                            //Tab View
                            tabControlFuncionalities.TabPages.Remove(tabPageView);

                            //Tab Reject
                            tabControlFuncionalities.TabPages.Remove(tabPageReject);

                            //Tab Correct
                            tabControlFuncionalities.TabPages.Remove(tabPageRequestCorrection);

                            #endregion

                            HideNotification();
                            ShowLoading();
                            break;
                        }
                    case AppState.AfterReview:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //Tab View
                            panelView.Enabled = true;
                            if (!tabControlFuncionalities.TabPages.Contains(tabPageReview))
                                tabControlFuncionalities.TabPages.Add(tabPageReview);

                            //Tab review
                            btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                                btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = true;
                            btnApprove.Text = "Approve";

                            tabControlFuncionalities.SelectedTab = tabPageReview;

                            #endregion

                            ShowNotification(Properties.Resources.TEXT_INFO_REVIEW_OK, ENotificationType.Success);

                            break;
                        }
                    case AppState.ErrorReviewing:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            #endregion

                            break;
                        }
                    case AppState.Approving:
                        {
                            #region Deshabiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = false;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = false;

                            //Tab Overview
                            jobsViewer1.Enabled = false;

                            //panelReview
                            //panelReview.Enabled = false;
                            btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                                btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = false;

                            //Tab Reject
                            tabControlFuncionalities.TabPages.Remove(tabPageReject);

                            //Tab Correct
                            tabControlFuncionalities.TabPages.Remove(tabPageRequestCorrection);

                            #endregion

                            HideNotification();
                            ShowLoading();
                            break;
                        }
                    case AppState.AfterApprove:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //panelReview
                            panelReview.Enabled = true;

                            //tab page Review
                            btnApprove.Enabled = true;
                            btnApprove.Text = "Done";

                            #endregion

                            ShowNotification(Properties.Resources.TEXT_INFO_APPROVED_OK, ENotificationType.Success);

                            btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = false;
                            _selectedRating = string.Empty;

                            UpdateJobState();

                            break;
                        }
                    case AppState.ErrorApproving:
                        {
                            #region Habiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //panelReview
                            panelReview.Enabled = true;

                            //tab page Review
                            btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                                btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = true;
                            btnApprove.Text = "Approve";

                            #endregion

                            break;
                        }
                    case AppState.BeforeRequestCorrection:
                        {
                            #region Inicializando contoles visuales

                            // Eliminando tabPageReject
                            if (tabControlFuncionalities.TabPages.Contains(tabPageReject))
                                tabControlFuncionalities.TabPages.Remove(tabPageReject);

                            // Añadiendo tabPageRequestCorrection
                            if (!tabControlFuncionalities.TabPages.Contains(tabPageRequestCorrection))
                                tabControlFuncionalities.TabPages.Add(tabPageRequestCorrection);
                            tabControlFuncionalities.SelectedTab = tabPageRequestCorrection;

                            // Mostrando el Job en el job viewer
                            jobViewerSingleCorrectJob.LoadJob(_selectedJob);

                            lblFieldEmptyFormalCorrection.Visible = false;
                            textBoxCorrectionRequest.ReadOnly = false;
                            textBoxCorrectionRequest.Text = string.Empty;
                            btnRequestCorrection.Enabled = false;
                            btnRequestCorrection.Text = "Request correction";

                            #endregion

                            HideNotification();

                            break;
                        }
                    case AppState.RequestingCorrection:
                        {
                            #region Deshabiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = false;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = false;

                            //Tab Overview
                            jobsViewer1.Enabled = false;

                            //panelReview
                            //panelReview.Enabled = false;
                            btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                                btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = false;

                            //Tab Correct
                            textBoxCorrectionRequest.ReadOnly = true;
                            btnRequestCorrection.Enabled = false;

                            #endregion

                            HideNotification();
                            ShowLoading();

                            break;
                        }
                    case AppState.AfterRequestCorrection:
                        {
                            #region Habilitando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //panelReview
                            //panelReview.Enabled = false;
                            //btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled = true;

                            btnRequestCorrection.Enabled = true;
                            btnRequestCorrection.Text = "Done";

                            btnApprove.Enabled = true;
                            btnApprove.Text = "Done";

                            #endregion

                            ShowNotification(Properties.Resources.TEXT_INFO_REQCORRECTION_OK, ENotificationType.Success);

                            //Actualizndo el estado del job en el list view
                            jobViewerSingleCorrectJob.LoadJob(_selectedJob);
                            jobViewerSingleReview.LoadJob(_selectedJob);
                            UpdateJobState();

                            break;
                        }
                    case AppState.ErrorRequestingCorrection:
                        {

                            #region Inicializando contoles visuales

                            textBoxCorrectionRequest.ReadOnly = false;
                            btnRequestCorrection.Enabled = true;

                            #endregion

                            #region Habilitando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                               btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = true;

                            #endregion

                            break;
                        }
                    case AppState.BeforeReject:
                        {
                            #region Inicializando controles visuales

                            pictureBoxLoadingCaptcha.Visible = lbLoadingCaptcha.Visible = false;

                            // Eliminando tabPageRequestCorrection
                            if (tabControlFuncionalities.TabPages.Contains(tabPageRequestCorrection))
                                tabControlFuncionalities.TabPages.Remove(tabPageRequestCorrection);

                            //Incializando el captcha

                            UpdateCaptchaImage();

                            // Añadiendo tabPageRequestCorrection
                            if (!tabControlFuncionalities.TabPages.Contains(tabPageReject))
                                tabControlFuncionalities.TabPages.Add(tabPageReject);
                            tabControlFuncionalities.SelectedTab = tabPageReject;

                            // Mostrando el Job en el job viewer
                            jobViewerSingleRejectJob.LoadJob(_selectedJob);

                            lblFieldEmptyFeedback.Visible = false;
                            textBoxFeedBack.ReadOnly = false;
                            textBoxFeedBack.Text = string.Empty;

                            lblFieldEmptyCaptcha.Visible = false;
                            textBoxCaptcha.ReadOnly = false;
                            textBoxCaptcha.Text = string.Empty;
                            textBoxCaptcha.Enabled = false;

                            panelFollowUp.Enabled = true;
                            panelReason.Enabled = true;
                            btnReject.Enabled = false;
                            btnReject.Text = "Reject";

                            _captchaLoaded = false;

                            radioBtnFollowUpAnotherTranslator.Checked = radioBtnReasonQuality.Checked = true;

                            #endregion

                            ShowLoading();
                            HideNotification();

                            break;
                        }
                    case AppState.Rejecting:
                        {
                            #region Deshabiltando controles visuales

                            //Tab start
                            btnLogIn.Enabled = false;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = false;

                            //Tab Overview
                            jobsViewer1.Enabled = false;

                            //panelReview
                            //panelReview.Enabled = false;
                            btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                                btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = false;

                            //Tab Reject
                            textBoxFeedBack.ReadOnly = true;
                            textBoxCaptcha.ReadOnly = true;

                            panelFollowUp.Enabled = false;
                            panelReason.Enabled = false;
                            btnReject.Enabled = false;

                            #endregion

                            HideNotification();
                            ShowLoading();

                            break;
                        }
                    case AppState.AfterReject:
                        {
                            #region Habilitando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            //panelReview
                            //panelReview.Enabled = false;
                            //btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled = true;

                            btnReject.Enabled = true;
                            btnReject.Text = "Done";

                            btnApprove.Enabled = true;
                            btnApprove.Text = "Done";

                            #endregion

                            ShowNotification(Properties.Resources.TEXT_INFO_REJECT_OK, ENotificationType.Success);

                            //Actualizndo el estado del job en el list view
                            jobViewerSingleRejectJob.LoadJob(_selectedJob);
                            jobViewerSingleReview.LoadJob(_selectedJob);
                            UpdateJobState();

                            break;
                        }
                    case AppState.ErrorRejecting:
                        {
                            if (_errorInfo.ErrorCode == EErrorCode.REJECT_WRONG_CAPTCHA)
                            {
                                pictureBoxCaptcha.ErrorImage = null;
                                pictureBoxCaptcha.InitialImage = null;
                                pictureBoxCaptcha.Image = null;
                                pictureBoxCaptcha.ImageLocation = string.Empty;

                                pictureBoxCaptcha.Refresh();
                                pictureBoxLoadingCaptcha.Visible = lbLoadingCaptcha.Visible = true;
                                textBoxCaptcha.Text = string.Empty;

                                _clientWrapper.ViewJob(ViewJobWrongCaptcha_CallBack, Generic_ErrorCallBack, _selectedJob.Job_Id, string.Empty);
                                return;
                            }

                            #region Inicializando controles visuales

                            textBoxFeedBack.ReadOnly = false;

                            textBoxCaptcha.ReadOnly = false;

                            panelFollowUp.Enabled = true;
                            panelReason.Enabled = true;
                            btnReject.Enabled = true;
                            btnReject.Text = "Reject";

                            #endregion

                            #region Habilitando controles visuales

                            //Tab start
                            btnLogIn.Enabled = true;

                            //Tab Order
                            panelOrder1.Enabled = panelOrder2.Enabled = true;

                            //Tab Overview
                            jobsViewer1.Enabled = true;

                            btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                              btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = true;

                            #endregion

                            break;
                        }
                    default:
                        break;
                }
            }
        }
 private void btnDoneView_Click(object sender, EventArgs e)
 {
     _selectedJob = null;
     tabControlFuncionalities.SelectedTab = tabPageOverview;
     tabControlFuncionalities.TabPages.Remove(tabPageView);
 }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            _refreshing = true;

            _appState = AppState.BeforeLogin;
            ConfigureUI();

            _languageList = null;
            _languagePairs = null;
            _selectedLanguagePairs = null;
            _languageFrom = null;
            _unitPrice = -1;
            _tierClicked = false;
            _wordCount = 0;
            _selectedTier = string.Empty;
            _jobList = null;
            _selectedJob = null;
            _selectedRating = string.Empty;
            _captchaLoaded = false;

            tabControlFuncionalities.TabPages.Remove(tabPageReject);
            tabControlFuncionalities.TabPages.Remove(tabPageRequestCorrection);
            tabControlFuncionalities.TabPages.Remove(tabPageReview);
            tabControlFuncionalities.TabPages.Remove(tabPageView);

            Session session = GetSession();
            if (session != null)
            {
                textBoxPrivateKey.Text = session.PrivateKey;
                textboxPublicKey.Text = session.PublicKey;
                LogIn();
            }
        }
        private void ViewJobWrongCaptcha_CallBack(Job pJob)
        {
            if (textBoxFeedBack.InvokeRequired)
            {
                ViewJobWrongCaptcha_CallBackCallBack d = new ViewJobWrongCaptcha_CallBackCallBack(ViewJobWrongCaptcha_CallBack);
                this.Invoke(d, pJob);
            }
            else
            {
                _selectedJob = pJob;

                //Incializando el captcha
                UpdateCaptchaImage();

                jobViewerSingleRejectJob.LoadJob(_selectedJob);
                jobViewerSingleReview.LoadJob(_selectedJob);

                UpdateJobState();

                #region Inicializando controles visuales

                textBoxFeedBack.ReadOnly = false;

                textBoxCaptcha.ReadOnly = false;

                panelFollowUp.Enabled = true;
                panelReason.Enabled = true;
                btnReject.Enabled = true;
                btnReject.Text = "Reject";

                #endregion

                #region Habilitando controles visuales

                //Tab start
                btnLogIn.Enabled = true;

                //Tab Order
                panelOrder1.Enabled = panelOrder2.Enabled = true;

                //Tab Overview
                jobsViewer1.Enabled = true;

                btnRating1.Enabled = btnRating2.Enabled = btnRating3.Enabled = btnRating4.Enabled = btnRating5.Enabled =
                  btnShowRejectForm.Enabled = btnShowCorrectForm.Enabled = btnApprove.Enabled = true;

                #endregion
            }
        }
        private void ViewJob_SuccessCallback(Job pJob)
        {
            _appState = AppState.AfterView;
            ConfigureUI();

            ShowJobDataTabPageView(pJob);
        }
        private void ViewJobReject_SuccessCallback(Job pJob)
        {
            _selectedJob = pJob;

            _appState = AppState.AfterReject;
            ConfigureUI();
        }
        private void ViewJobRequestCorrection_SuccessCallback(Job pJob)
        {
            _selectedJob = pJob;

            _appState = AppState.AfterRequestCorrection;
            ConfigureUI();
        }
        private void TransalteJob_SuccessCallback(Job pJob)
        {
            if (_jobList == null)
                _jobList = new List<Job>();
            _jobList.Insert(0, pJob);

            _clientWrapper.GetAccountBalance(GetAccountBalanceOrdered_SuccessCallback, Generic_ErrorCallBack);
        }
        private void ViewJobApprove_SuccessCallback(Job pJob)
        {
            _selectedJob = pJob;
            _appState = AppState.AfterApprove;
            ConfigureUI();

            ShowJobDataTabPageReview(_selectedJob);
        }
Esempio n. 10
0
        private void ShowJobDataTabPageReview(Job pJob)
        {
            if (tabControlFuncionalities.InvokeRequired)
            {
                ShowJobDataTabPageReviewCallBack d = new ShowJobDataTabPageReviewCallBack(ShowJobDataTabPageReview);
                this.Invoke(d, new object[] { pJob });
            }
            else
            {
                jobViewerSingleReview.LoadJob(pJob);

                lbOriginalTextReview.Text = "Original text " + "[" + GetLanguageStr(_selectedJob.Lc_src) + "]";
                textBoxOriginalTextReview.Text = pJob.Body_src;
                //textBoxOriginalTextReview.Enabled = false;
                textBoxOriginalTextReview.ReadOnly = true;

                if (_selectedJob.Status == EJobStatus.JOB_STATUS_APPROVED)
                {
                    textBoxTranslatedTextReview.Visible = true;
                    textBoxTranslatedTextReview.Text = pJob.Body_tgt;
                    pictureBoxTranslatedTextReview.Visible = false;
                }
                else
                {
                    textBoxTranslatedTextReview.Visible = false;
                    pictureBoxTranslatedTextReview.Visible = true;
                }

                lbTranslatedTextReview.Text = "Translated text " + "[" + GetLanguageStr(_selectedJob.Lc_tgt) + "]";

                //string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + Properties.Resources.AppDirectory + "Previews";
                //string impagePath = string.Format("{0}/{1}", folder, pJob.PreviewImage);

                string impagePath = pJob.PreviewImage;
                pictureBoxTranslatedTextReview.ImageLocation = impagePath;
            }
        }
Esempio n. 11
0
        private void ShowJobDataTabPageView(Job pJob)
        {
            if (tabControlFuncionalities.InvokeRequired)
            {
                ShowJobDataTabPageViewCallBack d = new ShowJobDataTabPageViewCallBack(ShowJobDataTabPageView);
                this.Invoke(d, new object[] { pJob });
            }
            else
            {
                jobViewerSingleView.LoadJob(pJob);

                lbOriginalTextView.Text = "Original text " + "[" + GetLanguageStr(pJob.Lc_src) + "]";
                textBoxOriginalTextView.Text = pJob.Body_src;
                //textBoxOriginalTextView.Enabled = false;
                textBoxOriginalTextView.ReadOnly = true;
                lbTranslatedTextView.Text = "Translated text " + "[" + GetLanguageStr(pJob.Lc_tgt) + "]";
                textBoxTranslatedTextView.Text = pJob.Body_tgt;
                //textBoxTranslatedTextView.Enabled = false;
                textBoxTranslatedTextView.ReadOnly = true;

                pictureBoxMtView.Visible = lbMtTexView.Visible = pJob.Status != EJobStatus.JOB_STATUS_APPROVED;

            }
        }
Esempio n. 12
0
        private void ReviewJob_SuccessCallback(Job pJob)
        {
            _appState = AppState.AfterReview;
            ConfigureUI();

            _selectedJob.Body_src = pJob.Body_src;
            _selectedJob.PreviewImage = pJob.PreviewImage;
            if(!string.IsNullOrEmpty(pJob.CaptchaURL))
                _selectedJob.CaptchaURL = pJob.CaptchaURL;

            ShowJobDataTabPageReview(_selectedJob);
        }
Esempio n. 13
0
        void jobsViewer1_ViewClick(object sender, object job)
        {
            if (job == null)
                return;

            _selectedJob = job as Job;

            _appState = AppState.Viewing;
            ConfigureUI();

            string pre_mt = string.Empty;
            if (_selectedJob.Status != EJobStatus.JOB_STATUS_APPROVED)
            {
                pre_mt = "1";
            }

            _clientWrapper.ViewJob(ViewJob_SuccessCallback, Generic_ErrorCallBack, _selectedJob.Job_Id, pre_mt);
        }
Esempio n. 14
0
        void jobsViewer1_ReviewClick(object sender, object job)
        {
            if (job == null)
                return;

            _selectedJob = job as Job;

            _appState = AppState.Reviewing;
            ConfigureUI();

            _clientWrapper.ReviewJob(ReviewJob_SuccessCallback, Generic_ErrorCallBack, _selectedJob.Job_Id);
        }
Esempio n. 15
0
        void jobsViewer1_CancelClick(object sender, object job)
        {
            if (job == null)
                return;

            _selectedJob = job as Job;

            _appState = AppState.Canceling;
            ConfigureUI();

            _clientWrapper.CancelJob(CancelJob_SuccessCallback, Generic_ErrorCallBack, ((Job)job).Job_Id);
        }
Esempio n. 16
0
        /// <summary>
        /// Método utilizado para parsear la respuesta JSon de la api a un objeto del dominio del wrapper
        /// </summary>
        /// <param name="result">respuesta en formato JSon de la API</param>
        /// <param name="apiMethod">Enumerado que representa el método en cuestión</param>
        /// <returns></returns>
        private object ConvertResultToObject(string result, ApiMethod apiMethod)
        {
            object objectResult = null;

            switch (apiMethod)
            {
                case ApiMethod.GetAccountBalance:
                    {
                        //{"opstat": "ok","response": {"credits": "1003.60"}}
                        object resultJson = JsonConvert.DeserializeObject(result);
                        JObject responseJson = (JObject)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;
                        string creditsStr = responseJson.Property("credits").Value.ToString();
                        creditsStr = creditsStr.Replace("\"", "");
                        objectResult = Convert.ToSingle(creditsStr);

                        break;
                    }
                case ApiMethod.GetMyJobs:
                    {
                        //{"opstat":"ok","response":[{
                        //                          "job_id": "77777",
                        //                          "slug": "adfadfdsfaf.",
                        //                          "body_src": "Un texto",
                        //                          "lc_src": "en",
                        //                          "lc_tgt": "ja",
                        //                          "unit_count": "2",
                        //                          "tier": "machine",
                        //                          "credits": "0.80",
                        //                          "status": "available",
                        //                          "eta": "",
                        //                          "ctime": 1315423968,
                        //                          "callback_url": "",
                        //                          "auto_approve": "0",
                        //                          "custom_data": ""
                        //                          },{
                        //                              //otro job
                        //                          }]}

                        object resultJson = JsonConvert.DeserializeObject(result);
                        //JObject responseJson = (JObject)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;
                        JArray array = (JArray)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;

                        List<Job> jobsList = new List<Job>();
                        Job jobClient = null;
                        foreach (JObject job in array)
                        {
                            //NO se muestra un job con este estado!!! (17-3-2012). Razón: una vex z que se ordena un trabajo con tier = ultra,
                            //La API devuelve doble dicho trabajo, la copia vuelve con tier = ultra_proofread y no nos interesa motrar esto.
                            string tier = job.Property("tier").Value.ToString().Replace("\"", "");
                            if (tier == Properties.Resources.TIER_ULTRA_PROOFREAD)
                                continue;

                            jobClient = new Job();
                            jobClient.Job_Id = job.Property("job_id").Value.ToString().Replace("\"", "");
                            jobClient.Slug = job.Property("slug").Value.ToString().Replace("\"", "");
                            jobClient.Body_src = job.Property("body_src").Value.ToString().Replace("\"", "");
                            jobClient.Lc_src = job.Property("lc_src").Value.ToString().Replace("\"", "");
                            jobClient.Lc_tgt = job.Property("lc_tgt").Value.ToString().Replace("\"", "");
                            jobClient.Unit_count = Convert.ToInt32(job.Property("unit_count").Value.ToString().Replace("\"", ""));
                            jobClient.Tier = job.Property("tier").Value.ToString().Replace("\"", "");
                            string credits_str = job.Property("credits").Value.ToString().Replace("\"", "");
                            jobClient.Credits = Convert.ToSingle(credits_str);
                            //jobClient.Credits = (float)Convert.ToDouble(credits_str);
                            //jobClient.Credits = float.Parse(credits_str, System.Globalization.NumberStyles.Currency);
                            //jobClient.Credits = float.Parse(credits_str, System.Globalization.NumberStyles.Currency);
                            jobClient.Status = job.Property("status").Value.ToString().Replace("\"", "");
                            jobClient.Eta = job.Property("eta").Value.ToString().Replace("\"", "");

                            //TODO: Buscar mecasimo para convertir a una fecha váldia!!!
                            string ctimeStr = job.Property("ctime").Value.ToString().Replace("\"", "");
                            jobClient.Ctime = Utils.ConvertFromUnixTimeStamp(Convert.ToDouble(ctimeStr));
                            //jobClient.Custom_data = job.Property("custom_data").Value.ToString();

                            if (job.Property("captcha_url") != null && job.Property("captcha_url").Value != null)
                                jobClient.CaptchaURL = job.Property("captcha_url").Value.ToString().Replace("\"", "");

                            jobsList.Add(jobClient);
                        }

                        objectResult = jobsList;
                        break;
                    }
                case ApiMethod.GetLanguages:
                    {
                        //{"opstat":"ok","response":[{
                        //                          "language": "English",
                        //                          "localized_name": "English",
                        //                          "lc": "en",
                        //                          "unit_type": "word"
                        //                          },{
                        //                              //otro language
                        //                          }]}

                        object resultJson = JsonConvert.DeserializeObject(result);
                        //JObject responseJson = (JObject)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;
                        JArray array = (JArray)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;

                        List<Language> languageList = new List<Language>();
                        Language language = null;
                        foreach (JObject job in array)
                        {
                            language = new Language();
                            language.LanguageName = job.Property("language").Value.ToString().Replace("\"", "");
                            language.LocalizedName = job.Property("localized_name").Value.ToString().Replace("\"", "");
                            language.Lc = job.Property("lc").Value.ToString().Replace("\"", "");
                            language.UnitType = job.Property("unit_type").Value.ToString().Replace("\"", "");
                            languageList.Add(language);
                        }

                        languageList.Insert(0, new Language() { LanguageName = Properties.Resources.NotSpecified, Lc = string.Empty });
                        objectResult = languageList;
                        break;
                    }
                case ApiMethod.GetLanguagePairs:
                    {
                        //{"opstat":"ok","response":[{
                        //                          "lc_src": "de",
                        //                          "lc_tgt": "en",
                        //                          "tier": "machine",
                        //                          "unit_price": "0.0000"
                        //                          },{
                        //                              //otro language pair
                        //                          }]}

                        object resultJson = JsonConvert.DeserializeObject(result);
                        //JObject responseJson = (JObject)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;
                        JArray array = (JArray)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;

                        List<LanguagePair> languageList = new List<LanguagePair>();
                        LanguagePair languagePair = null;
                        foreach (JObject job in array)
                        {
                            languagePair = new LanguagePair();
                            languagePair.Lc_src = job.Property("lc_src").Value.ToString().Replace("\"", "");
                            languagePair.Lc_tgt = job.Property("lc_tgt").Value.ToString().Replace("\"", "");
                            languagePair.Tier = job.Property("tier").Value.ToString().Replace("\"", "");
                            string unitPrice = job.Property("unit_price").Value.ToString().Replace("\"", "");
                            languagePair.Unit_price = Convert.ToSingle(unitPrice);
                            languageList.Add(languagePair);
                        }

                        objectResult = languageList;
                        break;
                    }
                case ApiMethod.TranslateJob:
                    {
                        //                        {
                        //  "opstat": "ok",
                        //  "response": {
                        //    "jobs": [
                        //      {
                        //        "job1": {
                        //          "job_id": "15723",
                        //          "slug": "Un texto para traducir",
                        //          "body_src": "Un texto",
                        //          "lc_src": "en",
                        //          "lc_tgt": "es",
                        //          "unit_count": "2",
                        //          "tier": "ultra_pro",
                        //          "credits": "0.40",
                        //          "status": "available",
                        //          "eta": "",
                        //          "ctime": 1297743137,
                        //          "callback_url": "",
                        //          "auto_approve": "0",
                        //          "custom_data": "",
                        //          "body_tgt": "Un Texto",
                        //          "mt": 1
                        //        }
                        //      }
                        //    ]
                        //  }
                        //}

                        object resultJson = JsonConvert.DeserializeObject(result);
                        JObject resposeObject = (JObject)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;
                        JArray arrayJobs = (JArray)resposeObject.Property("jobs").Value;
                        JObject job = (JObject)((JObject)arrayJobs[0]).Property("job1").Value;

                        //JArray array = (JArray)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;

                        Job jobClient = null;

                        jobClient = new Job();
                        jobClient.Job_Id = job.Property("job_id").Value.ToString().Replace("\"", "");
                        jobClient.Slug = job.Property("slug").Value.ToString().Replace("\"", "");
                        jobClient.Body_src = job.Property("body_src").Value.ToString().Replace("\"", "");
                        jobClient.Lc_src = job.Property("lc_src").Value.ToString().Replace("\"", "");
                        jobClient.Lc_tgt = job.Property("lc_tgt").Value.ToString().Replace("\"", "");
                        jobClient.Unit_count = Convert.ToInt32(job.Property("unit_count").Value.ToString().Replace("\"", ""));
                        jobClient.Tier = job.Property("tier").Value.ToString().Replace("\"", "");
                        jobClient.Credits = Convert.ToSingle(job.Property("credits").Value.ToString().Replace("\"", ""));
                        jobClient.Status = job.Property("status").Value.ToString().Replace("\"", "");
                        jobClient.Eta = job.Property("eta").Value.ToString().Replace("\"", "");

                        //TODO: Buscar mecasimo para convertir a una fecha váldia!!!
                        string ctimeStr = job.Property("ctime").Value.ToString().Replace("\"", "");
                        jobClient.Ctime = Utils.ConvertFromUnixTimeStamp(Convert.ToDouble(ctimeStr));
                        //jobClient.Custom_data = job.Property("custom_data").Value.ToString();

                        objectResult = jobClient;
                        break;
                    }
                case ApiMethod.CancelJob:
                    {
                        //{"opstat": "ok","response": {}}
                        object resultJson = JsonConvert.DeserializeObject(result);
                        string responseJson = (string)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("opstat")).Value.ToString();
                        bool canceldOK = responseJson == "ok";
                        objectResult = canceldOK;

                        break;
                    }
                case ApiMethod.ViewJob:
                    {
                        //                        {
                        //  "opstat": "ok",
                        //  "response": {
                        //    "job": {
                        //      "job_id": "16673",
                        //      "slug": "aplicaci\\u00f3n",
                        //      "body_src": "Un cami\\u00f3n. Confronted with this situation, most IT professionals chose a middle ground, which forced information workers to make critical security decisions. If a document contained ActiveX controls or macros from an unknown source, users were asked whether they wanted to enable the ActiveX controls or the macros. Users were not allowed to access the document until they answered the question. Although this was not a perfect solution, it did provide a mechanism for mitigating security threats without intruding too much on productivity. The main problem was that most users, when confronted with a security warning, dismissed the warning so they could access the document and get their work done. This was acceptable for low-risk internal documents that did not likely contain malicious content, but it was not acceptable for high-risk external documents that passed through the Internet and could contain malicious content. Unfortunately, users did not usually distinguish between high-risk and low-risk files and treated both files the same way — that is, they accepted the risk and enabled the ActiveX controls and macros.",
                        //      "lc_src": "en",
                        //      "lc_tgt": "es",
                        //      "unit_count": "8",
                        //      "tier": "pro",
                        //      "credits": "0.80",
                        //      "status": "approved",
                        //      "eta": "",
                        //      "ctime": 1298861619,
                        //      "callback_url": "",
                        //      "auto_approve": "0",
                        //      "custom_data": "",
                        //      "body_tgt": "Una aplicaci\\u00f3n. Confronted with this situation, most IT professionals chose a middle ground, which forced information workers to make critical security decisions. If a document contained ActiveX controls or macros from an unknown source, users were asked whether they wanted to enable the ActiveX controls or the macros. Users were not allowed to access the document until they answered the question. Although this was not a perfect solution, it did provide a mechanism for mitigating security threats without intruding too much on productivity. The main problem was that most users, when confronted with a security warning, dismissed the warning so they could access the document and get their work done. This was acceptable for low-risk internal documents that did not likely contain malicious content, but it was not acceptable for high-risk external documents that passed through the Internet and could contain malicious content. Unfortunately, users did not usually distinguish between high-risk and low-risk files and treated both files the same way — that is, they accepted the risk and enabled the ActiveX controls and macros. Confronted with this situation, most IT professionals chose a middle ground, which forced information workers to make critical security decisions. If a document contained ActiveX controls or macros from an unknown source, users were asked whether they wanted to enable the ActiveX controls or the macros. Users were not allowed to access the document until they answered the question. Although this was not a perfect solution, it did provide a mechanism for mitigating security threats without intruding too much on productivity. The main problem was that most users, when confronted with a security warning, dismissed the warning so they could access the document and get their work done. This was acceptable for low-risk internal documents that did not likely contain malicious content, but it was not acceptable for high-risk external documents that passed through the Internet and could contain malicious content. Unfortunately, users did not usually distinguish between high-risk and low-risk files and treated both files the same way — that is, they accepted the risk and enabled the ActiveX controls and macros."
                        //    }
                        //  }
                        //}

                        object resultJson = JsonConvert.DeserializeObject(result);
                        JObject resposeObject = (JObject)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;
                        JObject job = (JObject)((JObject)resposeObject).Property("job").Value;

                        Job jobClient = null;

                        jobClient = new Job();
                        jobClient.Job_Id = job.Property("job_id").Value.ToString().Replace("\"", "");
                        jobClient.Slug = job.Property("slug").Value.ToString().Replace("\"", "");
                        jobClient.Body_src = job.Property("body_src").Value.ToString().Replace("\"", "");
                        if (job.Property("body_tgt") != null && job.Property("body_tgt").Value != null)
                            jobClient.Body_tgt = job.Property("body_tgt").Value.ToString().Replace("\"", "");
                        jobClient.Lc_src = job.Property("lc_src").Value.ToString().Replace("\"", "");
                        jobClient.Lc_tgt = job.Property("lc_tgt").Value.ToString().Replace("\"", "");
                        jobClient.Unit_count = Convert.ToInt32(job.Property("unit_count").Value.ToString().Replace("\"", ""));
                        jobClient.Tier = job.Property("tier").Value.ToString().Replace("\"", "");
                        jobClient.Credits = Convert.ToSingle(job.Property("credits").Value.ToString().Replace("\"", ""));
                        jobClient.Status = job.Property("status").Value.ToString().Replace("\"", "");
                        jobClient.Eta = job.Property("eta").Value.ToString().Replace("\"", "");
                        if (job.Property("captcha_url") != null && job.Property("captcha_url").Value != null)
                            jobClient.CaptchaURL = job.Property("captcha_url").Value.ToString().Replace("\"", "");

                        //TODO: Buscar mecasimo para convertir a una fecha váldia!!!
                        string ctimeStr = job.Property("ctime").Value.ToString().Replace("\"", "");
                        jobClient.Ctime = Utils.ConvertFromUnixTimeStamp(Convert.ToDouble(ctimeStr));
                        //jobClient.Custom_data = job.Property("custom_data").Value.ToString();

                        objectResult = jobClient;
                        break;
                    }
                case ApiMethod.ReviewJob:
                    {
                        // {
                        //  "opstat": "ok",
                        //  "response": {
                        //    "job_id": "16613",
                        //    "body_src": " aplicaci\\u00f3n. Developing mobile applications used to be an arcane activity pursued by highly specialized developers, but no more. The surge in popularity of Android devices, BlackBerries, and iPhones has application development professionals gearing up to incorporate mobile development into mainstream development processes. The first step in taking mobile development mainstream is defining your strategy. Learn from your peers in consumer product strategy by applying Forrester's POST method to your mobile development efforts. Begin by understanding what types of mobile users you need to support. Next, determine your objectives, and then build a strategy based on your desired offering and level of corporate commitment to mobile. Once you have completed these three steps, then — and only then — should you choose from among the six mobile development styles at your disposal and the vendors that offer mobile platforms and tools that can aid your efforts.",
                        //    "imagePreview": "~/_wpresources/MiguelRa.spGengo/spGengo/asp_mock/preview/jobPreview16613.jpg"
                        //  }
                        //}

                        object resultJson = JsonConvert.DeserializeObject(result);
                        JObject resposeObject = (JObject)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("response")).Value;
                        //JObject job = (JObject)((JObject)resposeObject).Property("job").Value;

                        Job jobClient = null;

                        jobClient = new Job();
                        jobClient.Job_Id = resposeObject.Property("job_id").Value.ToString().Replace("\"", "");

                        jobClient.Body_src = resposeObject.Property("body_src").Value.ToString().Replace("\"", "");
                        jobClient.PreviewImage = resposeObject.Property("imagePreview").Value.ToString().Replace("\"", "");

                        if (resposeObject.Property("captcha_url") != null && resposeObject.Property("captcha_url").Value != null)
                            jobClient.CaptchaURL = resposeObject.Property("captcha_url").Value.ToString().Replace("\"", "");

                        objectResult = jobClient;

                        break;
                    }
                case ApiMethod.ApproveJob:
                    {
                        //{"opstat": "ok","response": {}}
                        object resultJson = JsonConvert.DeserializeObject(result);
                        string responseJson = (string)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("opstat")).Value.ToString();
                        bool canceldOK = responseJson == "ok";
                        objectResult = canceldOK;

                        break;
                    }
                case ApiMethod.CorrectJob:
                    {
                        //{"opstat": "ok","response": {}}
                        object resultJson = JsonConvert.DeserializeObject(result);
                        string responseJson = (string)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("opstat")).Value.ToString();
                        bool canceldOK = responseJson == "ok";
                        objectResult = canceldOK;

                        break;
                    }
                case ApiMethod.RejectJob:
                    {
                        //{"opstat": "ok","response": {}}
                        object resultJson = JsonConvert.DeserializeObject(result);
                        string responseJson = (string)(((Newtonsoft.Json.Linq.JObject)resultJson).Property("opstat")).Value.ToString();
                        bool canceldOK = responseJson == "ok";
                        objectResult = canceldOK;

                        break;
                    }
                default:
                    break;
            }

            return objectResult;
        }