private Rounds UpdateRoundStatus(Image <Bgra, byte> enemyCrown, Image <Bgra, byte> ourCrown)
        {
            var howManyToCheck   = enemyCrown.Width * enemyCrown.Height / 20;
            var isEnemyCrownFull = ImageCompare.SearchForPixel(
                enemyCrown,
                Hardware.EnemyHalfCrown.Color,
                Hardware.EnemyHalfCrown.ColorVarience,
                howManyToCheck);
            var isOurCrownFull = ImageCompare.SearchForPixel(
                ourCrown,
                Hardware.OurHalfCrown.Color,
                Hardware.OurHalfCrown.ColorVarience,
                howManyToCheck);

            if (isEnemyCrownFull)
            {
                return(isOurCrownFull ? Rounds.Draw : Rounds.EnemyLead);
            }
            return(isOurCrownFull ? Rounds.WeLead : Rounds.FirstRound);
        }
        private async Task <bool> UpdateExtraDataParallel()
        {
            var ssManager = Services.Container.GetInstance <IScreenShotManager>();

            ssManager.UpdateImage();
            Ocr.SetImageGlobal(ssManager.CloneImage());

            #region Create tasks

            var isMulligan = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.MulliganDetection.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 100);
                return(Ocr.AreSame(
                           Hardware.MulliganDetection.Text,
                           image));
            });
            var isOurTurn = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.OurTurnDetection.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 192);
                //image.Save("ocr.bmp");
                return(Ocr.AreSame(
                           Hardware.OurTurnDetection.Text,
                           image));
            });
            var mustPlayCard = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.OurTurnDetection.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 192);
                var text = Ocr.GetText(image);
                return(Ocr.Distance(text, "F. -S") < Ocr.Distance(text, "PASS"));
            });
            var isLeaderOn = Task.Run(() =>
            {
                var leaderChargeScreen = ssManager.CloneImage(Hardware.LeaderChargeOn.Rectangle);
                var howManyToCheck     = leaderChargeScreen.Width * leaderChargeScreen.Height * Hardware.LeaderChargeOn.Percent / 100;
                var result             = ImageCompare.SearchForPixel(
                    leaderChargeScreen,
                    Hardware.LeaderChargeOn.Color,
                    Hardware.LeaderChargeOn.ColorVarience,
                    howManyToCheck);
                Services.Container.GetInstance <ITooltip>().Show($"isLeaderOn = {result}");
                return(result);
            });
            var isLeaderOff = Task.Run(() =>
            {
                var leaderChargeScreen = ssManager.CloneImage(Hardware.LeaderChargeOff.Rectangle);
                var howManyToCheck     = leaderChargeScreen.Width * leaderChargeScreen.Height * Hardware.LeaderChargeOff.Percent / 100;
                var result             = ImageCompare.SearchForPixel(
                    leaderChargeScreen,
                    Hardware.LeaderChargeOff.Color,
                    Hardware.LeaderChargeOff.ColorVarience,
                    howManyToCheck);
                //Services.Container.GetInstance<ITooltip>().Show($"isLeaderOff = {result}");
                return(result);
            });
            var isEnemyPassed = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EnemyPassedDetection.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(Hardware.EnemyPassedDetection.Text, image));
            });
            var isEndTurn = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EndTurnDetection.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 192);
                //image.Save("ocr.bmp");
                return(Ocr.AreSame(Hardware.EndTurnDetection.Text, image));
            });
            var ourScore = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.OurScoreLocation).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.GetNumber(image));
            });
            var enemyScore = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EnemyScoreLocation).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.GetNumber(image));
            });
            var roundStatus = Task.Run(() =>
            {
                var enemyCrown = ssManager.CloneImage(Hardware.EnemyHalfCrown.Rectangle);
                var ourCrown   = ssManager.CloneImage(Hardware.OurHalfCrown.Rectangle);
                return(UpdateRoundStatus(enemyCrown, ourCrown));
            });
            var isPickCard = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.PickCardDetection.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.PickCardDetection.Text, image));
            });
            var needStartGame = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.StartGameDetection.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.StartGameDetection.Text, image));
            });
            var isModalDialog1Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton1.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton1.Text, image));
            });
            var isModalDialog2Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton2.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton2.Text, image));
            });
            var isModalDialog3Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton3.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton3.Text, image));
            });
            var isModalDialog4Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton4.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton4.Text, image));
            });
            var isModalDialog5Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton5.Rectangle).Convert <Gray, byte>();
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton5.Text, image));
            });
            var isModalDialog6Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton6.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton6.Text, image));
            });
            var isModalDialog7Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton7.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton7.Text, image));
            });
            var isModalDialog8Opened = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.ModalDialogButton8.Rectangle).Convert <Gray, byte>();
                PreProcessText(image, 127);
                return(Ocr.AreSame(
                           Hardware.ModalDialogButton8.Text, image));
            });
            var isModalDialog9Opened = Task.Run(() =>
            {
                return(false);
            });
            var isModalDialog10Opened = Task.Run(() =>
            {
                return(false);
            });
            var isModalDialog11Opened = Task.Run(() =>
            {
                return(false);
            });
            var isEndGameDefeat = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EndGameResultLocation);
                return(ImageCompare.AreSame(image, Detect_endgame_defeat));
            });
            var isEndGameDraw = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EndGameResultLocation);
                return(ImageCompare.AreSame(image, Detect_endgame_draw));
            });
            var isEndGameVictory = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EndGameResultLocation);
                return(ImageCompare.AreSame(image, Detect_endgame_victory));
            });
            var isEndGameStreak = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EndGameStreakLocation);
                return(ImageCompare.AreSame(image, Detect_endgame_streak));
            });
            var undoAction = Task.Run(() =>
            {
                var undoScreen     = ssManager.CloneImage(Hardware.UndoAction.Rectangle);
                var howManyToCheck = undoScreen.Width * undoScreen.Height * Hardware.UndoAction.Percent / 100;
                return(ImageCompare.SearchForPixel(
                           undoScreen,
                           Hardware.UndoAction.Color,
                           Hardware.UndoAction.ColorVarience,
                           howManyToCheck));
            });
            var enemyTurn = Task.Run(() =>
            {
                var image = ssManager.CloneImage(Hardware.EnemyTurnDetection);
                return(ImageCompare.AreSame(image, Detect_Enemy_Turn));
            });

            #endregion

            await Task.WhenAll(
                isMulligan, isOurTurn, isLeaderOn, isLeaderOff,
                isEnemyPassed, isEndTurn, ourScore, enemyScore,
                roundStatus, isPickCard, needStartGame, isModalDialog1Opened,
                isModalDialog2Opened, isModalDialog3Opened, isModalDialog4Opened,
                isModalDialog5Opened, isModalDialog6Opened, isModalDialog7Opened,
                isEndGameDefeat, isEndGameDraw, isEndGameVictory, isEndGameStreak,
                mustPlayCard, undoAction, enemyTurn).ConfigureAwait(false);

            Extra.Update(
                isMulligan.Result, isOurTurn.Result, isLeaderOn.Result, isLeaderOff.Result,
                isEnemyPassed.Result, isEndTurn.Result, ourScore.Result, enemyScore.Result,
                roundStatus.Result, isPickCard.Result, needStartGame.Result,
                isEndGameDefeat.Result || isEndGameDraw.Result || isEndGameVictory.Result || isEndGameStreak.Result,
                isModalDialog1Opened.Result,
                isModalDialog2Opened.Result, isModalDialog3Opened.Result, isModalDialog4Opened.Result,
                isModalDialog5Opened.Result, isModalDialog6Opened.Result, isModalDialog7Opened.Result,
                isModalDialog8Opened.Result, isModalDialog9Opened.Result, isModalDialog10Opened.Result,
                isModalDialog11Opened.Result,
                mustPlayCard.Result, undoAction.Result, enemyTurn.Result);

            return(true);
        }