private async void ScrapMoreFromOriginalScreenshot(object sender, EventArgs args)
        {
            var screenshotPopup = new ScreenshotFullscreenPopup(File.ReadAllBytes(MainVM.SelectedPage.ScreenshotByteArray));

            screenshotPopup.BorderThickness = new Thickness(0, 0, 0, 0);
            System.Drawing.Rectangle workingArea = Screen.AllScreens[MainVM.DisplayIndex].WorkingArea;
            screenshotPopup.Left        = workingArea.Left;
            screenshotPopup.Top         = workingArea.Top;
            screenshotPopup.Width       = workingArea.Width;
            screenshotPopup.Height      = workingArea.Height;
            screenshotPopup.WindowState = WindowState.Maximized;
            screenshotPopup.WindowStyle = WindowStyle.None;
            screenshotPopup.Topmost     = true;
            screenshotPopup.ShowDialog();


            try
            {
                var result = (await VisionAPIHelper
                              .TextDetectionAsync(BitmapHelper.BitmapImageToBytes(screenshotPopup.CroppedImage)))[0]
                             .ToString();

                var    json = JObject.Parse(result);
                string text = json["description"].ToString();
                detectionContainer.Document.Blocks.Add(new Paragraph(new Run(text)));
                var range = new TextRange(detectionContainer.Document.ContentStart, (detectionContainer.Document.ContentEnd));
                SaveDectionResult(range);
            }
            catch (Exception err)
            {
                Console.WriteLine(err);
                detectionContainer.Document.Blocks.Add(new Paragraph(new Run("please try again")));
            }
        }
        private async void HandleScreenshot(object sender, EventArgs args)
        {
            if (MainVM.DoUsePreviousSelection == false)
            {
                var screenshotPopup = new ScreenshotFullscreenPopup(File.ReadAllBytes(MainVM.CurrentScreenshot));
                screenshotPopup.BorderThickness = new Thickness(0, 0, 0, 0);
                System.Drawing.Rectangle workingArea = Screen.AllScreens[MainVM.DisplayIndex].WorkingArea;
                screenshotPopup.Left = workingArea.Left;
                screenshotPopup.SourceInitialized += screenshotPopup_SourceInitialized;

                void screenshotPopup_SourceInitialized(object Sender, EventArgs Args)
                {
                    screenshotPopup.Top         = workingArea.Top;
                    screenshotPopup.Width       = workingArea.Width;
                    screenshotPopup.Height      = workingArea.Height;
                    screenshotPopup.WindowState = WindowState.Maximized;
                    screenshotPopup.WindowStyle = WindowStyle.None;
                    screenshotPopup.Topmost     = true;
                }

                screenshotPopup.ShowDialog();
                MainVM.CropLayer = screenshotPopup.CropLayer;
                this.WindowState = WindowState.Normal;
                try
                {
                    var response = await VisionAPIHelper.TextDetectionAsync(BitmapHelper.BitmapImageToBytes(screenshotPopup.CroppedImage));

                    var    result = response[0].ToString();
                    var    json   = JObject.Parse(result);
                    string text   = json["description"].ToString();
                    detectionContainer.Document.Blocks.Clear();
                    detectionContainer.Document.Blocks.Add(new Paragraph(new Run(text)));
                    var range = new TextRange(detectionContainer.Document.ContentStart, (detectionContainer.Document.ContentEnd));
                    SaveDectionResult(range);
                }
                catch (Exception err)
                {
                    detectionContainer.Document.Blocks.Clear();
                    detectionContainer.Document.Blocks.Add(new Paragraph(new Run("Please try again")));
                    var range = new TextRange(detectionContainer.Document.ContentStart, (detectionContainer.Document.ContentEnd));
                    SaveDectionResult(range);
                }
            }
            else
            {
                BitmapImage cropImageByPreviousSelection = BitmapHelper.CropImage(File.ReadAllBytes(MainVM.CurrentScreenshot), MainVM.CropLayer);
                try
                {
                    var    result = (await VisionAPIHelper.TextDetectionAsync(BitmapHelper.BitmapImageToBytes(cropImageByPreviousSelection)))[0].ToString();
                    var    json   = JObject.Parse(result);
                    string text   = json["description"].ToString();
                    detectionContainer.Document.Blocks.Clear();
                    detectionContainer.Document.Blocks.Add(new Paragraph(new Run(text)));
                    var range = new TextRange(detectionContainer.Document.ContentStart, (detectionContainer.Document.ContentEnd));
                    SaveDectionResult(range);
                }
                catch (Exception err)
                {
                    detectionContainer.Document.Blocks.Clear();
                    detectionContainer.Document.Blocks.Add(new Paragraph(new Run("mo text ar dai gor")));
                }
            }
        }