Esempio n. 1
0
        private void HandleFullFrame()
        {
            using (var ms = new MemoryStream())
            {
                using (var grab = ScreenData.CaptureDesktop())
                {
                    grab.Save(ms, ImageFormat.Jpeg);
                    var imgData = ms.ToArray();

                    var bounds       = Screen.PrimaryScreen.Bounds;
                    var screenBounds = new
                    {
                        top      = bounds.Top,
                        bottom   = bounds.Bottom,
                        left     = bounds.Left,
                        right    = bounds.Right,
                        height   = bounds.Height,
                        width    = bounds.Width,
                        x        = bounds.X,
                        y        = bounds.Y,
                        empty    = bounds.IsEmpty,
                        location = bounds.Location,
                        size     = bounds.Size
                    };
                    var frameData = new
                    {
                        screenBounds,
                        frameData = imgData.Select(b => (int)b).ToArray()
                    };
                    _builder.WriteMessage(frameData);
                }
            }
        }
Esempio n. 2
0
 private void HandleFullFrame()
 {
     using (var grab = ScreenData.CaptureDesktop())
     {
         var       imgData  = ScreenData.ImageToByteArray(grab);
         var       monitors = SystemInformation.Displays;
         Rectangle bounds;
         if (monitors.Count > 0 && monitors.ElementAt(ScreenData.ActiveDisplay) != null)
         {
             var activeDisplay = monitors[ScreenData.ActiveDisplay];
             bounds = new Rectangle
             {
                 X      = activeDisplay.CurrentResolution.X,
                 Y      = activeDisplay.CurrentResolution.Y,
                 Width  = activeDisplay.CurrentResolution.Width,
                 Height = activeDisplay.CurrentResolution.Height
             };
         }
         else
         {
             bounds = Display.GetWindowRectangle();
         }
         var screenBounds = new
         {
             top      = bounds.Top,
             bottom   = bounds.Bottom,
             left     = bounds.Left,
             right    = bounds.Right,
             height   = bounds.Height,
             width    = bounds.Width,
             x        = bounds.X,
             y        = bounds.Y,
             empty    = bounds.IsEmpty,
             location = bounds.Location,
             size     = bounds.Size
         };
         var frameData = new
         {
             screenBounds,
             frameData = imgData.Select(b => (int)b).ToArray()
         };
         _builder.WriteMessage(frameData);
     }
 }
Esempio n. 3
0
        public FrameInformation GetFullFrame()
        {
            HandleDesktop();
            var tempBounds = Display.GetWindowRectangle();
            var frameInfo  = new FrameInformation
            {
                Bounds      = tempBounds,
                ScreenImage = ScreenData.CaptureDesktop()
            };

            if (frameInfo.ScreenImage != null)
            {
                return(frameInfo);
            }
            var bmp = new Bitmap(frameInfo.Bounds.Width, frameInfo.Bounds.Height);

            using (var gfx = Graphics.FromImage(bmp))
                using (var brush = new SolidBrush(Color.FromArgb(67, 75, 99)))
                {
                    gfx.FillRectangle(brush, 0, 0, frameInfo.Bounds.Width, frameInfo.Bounds.Height);
                }
            frameInfo.ScreenImage = bmp;
            return(frameInfo);
        }