コード例 #1
0
        private void TakeFullScreenSnapsShot()
        {
            if (!_imgurApi.IsLoggedIn())
            {
                return;
            }
            _imgurApi.RefreshToken();
            var windowStateBefore   = WindowState;
            var showInTaskbarBefore = ShowInTaskbar;

            if (WindowState == WindowState.Normal)
            {
                WindowState   = WindowState.Minimized;
                ShowInTaskbar = false;
                while (ShowInTaskbar)
                {
                }
            }
            var screenShot   = new ScreenShot();
            var screenBuffer = screenShot.CaptureScreen();
            var imgurUpload  = new ImgurImage(screenBuffer);

            WindowState   = windowStateBefore;
            ShowInTaskbar = showInTaskbarBefore;
        }
コード例 #2
0
        public void SaveImage()
        {
            var screenPath = PresentSaveFileDialog();

            if (screenPath != "")
            {
                //Allow 250 milliseconds for the screen to repaint itself (we don't want to include this form in the capture)
                Task.Delay(500);

                var startPoint = new Point(View.Model.CurrentTopLeft.X, View.Model.CurrentTopLeft.Y);
                var bounds     = new Rectangle(View.Model.CurrentTopLeft.X, View.Model.CurrentTopLeft.Y,
                                               View.Model.CurrentBottomRight.X - View.Model.CurrentTopLeft.X, View.Model.CurrentBottomRight.Y - View.Model.CurrentTopLeft.Y);
                var fi = "";

                if (screenPath != "")
                {
                    fi = new FileInfo(screenPath).Extension;
                }

                ScreenShot.CaptureScreen(startPoint, Point.Empty, bounds, screenPath, fi);
                View.Model.SelectedArea = bounds;

                MessageBox.Show("Area saved to file", "SikuliLike", MessageBoxButtons.OK);
                View.Model.ImagePathLocation = screenPath;
                View.Model.SetImageLocation(screenPath, bounds);
            }
            else
            {
                MessageBox.Show("File save cancelled", "Abort", MessageBoxButtons.OK);
            }
        }
コード例 #3
0
 void Update()
 {
     if (Input.GetKeyUp(KeyCode.F4))
     {
         ScreenShot.CaptureScreen("ScreenShot",
                                  System.DateTime.Now.Year.ToString() +
                                  System.DateTime.Now.Month.ToString() +
                                  System.DateTime.Now.Day.ToString() +
                                  System.DateTime.Now.Hour.ToString() +
                                  System.DateTime.Now.Minute.ToString() +
                                  System.DateTime.Now.Second.ToString(),
                                  m_ScreenShotSuperSize);
     }
 }