Ejemplo n.º 1
0
        private void DoGetVerify(string reason, ProcActionFuture future)
        {
            if (future.IsCanceled)
            {
                return;
            }

            var account = Context.Account;
            var login   = Context.GetModule <LoginModule>(QQModuleType.LOGIN);

            login.GetCaptcha(account.Uin, (sender, Event) =>
            {
                if (Event.Type == QQActionEventType.EvtOK)
                {
                    var verify = new ImageVerify()
                    {
                        Type   = ImageVerify.VerifyType.LOGIN,
                        Image  = (Image)Event.Target,
                        Reason = reason,
                        Future = future
                    };
                    Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.CapachaVerify, verify));
                }
                else if (Event.Type == QQActionEventType.EvtError)
                {
                    future.NotifyActionEvent(QQActionEventType.EvtError, Event.Target);
                }
            });
        }
Ejemplo n.º 2
0
        void ExecuteVerifyCommand()
        {
            if (_imageVerify != null)
            {
                _imageVerify.Show();

                return;
            }

            _imageVerify             = new ImageVerify();
            _imageVerify.DataContext = new ImageVerifyViewModel(_imageFormat, _imageVerify);

            _imageVerify.Closed += (sender, args) => _imageVerify = null;

            _imageVerify.Show();
        }
Ejemplo n.º 3
0
        private void scanScore_Click(object sender, EventArgs e)
        {
            trueButton.Enabled      = false;
            nonAnswer.Enabled       = false;
            falseButton.Enabled     = false;
            undoButton.Enabled      = false;
            scoreDataButton.Enabled = false;

            // Create dialog box for image selection
            OpenFileDialog imageDialog = new OpenFileDialog();

            imageDialog.Filter           = "Image Files(*.BMP;*.JPG;*.GIF;*.png)|*.BMP;*.JPG;*.GIF;*.png";
            imageDialog.FilterIndex      = 1;
            imageDialog.Multiselect      = false;
            imageDialog.InitialDirectory = @"C:\MMPI2\" + grader.testTaker.lastName + grader.testTaker.firstName;
            DialogResult imageResult = imageDialog.ShowDialog();

            if (imageResult != DialogResult.OK) // Escape if no choice is made
            {
                trueButton.Enabled  = true;
                nonAnswer.Enabled   = true;
                falseButton.Enabled = true;
                undoButton.Enabled  = true;
                return;
            }
            mainOutput.Text += "Loading and Scanning Image! This might take a few seconds\r\n";
            ImageVerify verifyPage = new ImageVerify(imageDialog.FileName);

            if (!verifyPage.getFileValidity())
            {
                // Warning messages handled in verification class
                MessageBox.Show(verifyPage.getErrorMessage(), "Image Verification Failed",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            mainOutput.Text += "Page is valid\n";

            // Will open the markup image in windows photo viewer
            UserAnswersPage populateScores = new UserAnswersPage(imageDialog.FileName, verifyPage.getCoordPairings());
            List <bool?>    newInfo        = populateScores.getUserInfo();

            if (newInfo.Count != 567)
            {
                resetButton_Click(sender, e);
                return;
            }
            GC.Collect();

            // Launches new form modally
            using (EditAnswer answerChanger = new EditAnswer(newInfo, populateScores.getNonAnswers(), populateScores.getDoubleAnswers()))
            {
                answerChanger.ShowDialog();
                newInfo = answerChanger.getNewInfo();
                answerChanger.Dispose();
            }

            int nullCounter = 0;

            foreach (bool?answer in newInfo)
            {
                if (answer == null)
                {
                    nullCounter++;
                }
            }
            if (nullCounter > 6)
            {
                MessageBox.Show("There are too many non-answer/double answers.\r\nTotal: " + nullCounter);
                trueButton.Enabled  = true;
                nonAnswer.Enabled   = true;
                falseButton.Enabled = true;
                undoButton.Enabled  = true;
                return;
            }
            if (File.Exists(grader.indivFilePath))
            {
                File.Delete(grader.indivFilePath);
            }
            grader.basicInfoToFile();
            foreach (bool?answer in newInfo)
            {
                grader.singleUserEntry(answer);
                question++;
            }
            scoreDataButton.Enabled = true;
            scoreDataButton_Click(this, new EventArgs());
        }