コード例 #1
0
ファイル: Game1.cs プロジェクト: jmoral4/MonogameScreenTools
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
            ssh = new ScreenShotHelper(GraphicsDevice);
            gif = new GifMaker(GraphicsDevice);

            mgLogoBox = new Rectangle((graphics.PreferredBackBufferWidth / 3) + 200, (graphics.PreferredBackBufferHeight / 3), 400, 400);
        }
コード例 #2
0
        public void TearDown()
        {
            //Save screenshot if test failed
            if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed)
            {
                ScreenShotHelper.TakeScreenshot(WebDriver);
            }

            //Dispose driver instance which is binded to the current Test
            WebDriverManager.CleanupDriver();
        }
コード例 #3
0
        private static void UpdateZoneMap(string zoneHashId)
        {
            if (string.IsNullOrWhiteSpace(zoneHashId))
            {
                return;
            }

            try
            {
                var path = Path.GetTempPath() + "default.png";
                ScreenShotHelper.SaveActiveMapHack(path);
                var img  = Image.FromFile(path);
                var bArr = ImageHelper.ImgToByteArray(img);

                ZoneAccess.Instance.UpdateMapImage(zoneHashId, bArr);
            }
            catch { }
        }
コード例 #4
0
        /// <summary>
        /// Tira um print da página atual e salva no arquivo especificado
        /// </summary>
        /// <param name="nomeArquivo">Nome do arquivo</param>
        /// <param name="filePath">Diretório onde a imagem será salva</param>
        /// <param name="format">Formato da imagem salva</param>
        public void TakeScreeshot(string nomeArquivo, string filePath, ScreenshotImageFormat format)
        {
            try
            {
                if (string.IsNullOrEmpty(filePath))
                {
                    throw new ArgumentException("É necessário informar um diretório onde o arquivo será salvo.");
                }

                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                ITakesScreenshot screenshot = Driver as ITakesScreenshot;
                Screenshot       shot       = screenshot.GetScreenshot();

                shot.SaveAsFile(ScreenShotHelper.FormatFileName(nomeArquivo, filePath, format), format);
            }
            catch (WebDriverException e)
            {
                throw new WebDriverException(e.Message.ToString());
            }
        }
コード例 #5
0
 private void ColorZone_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     ScreenShotHelper.MaxWindow(this);
 }
コード例 #6
0
ファイル: MainViewModel.cs プロジェクト: boombos/flaxseed
 public void WindowMax()
 {
     ScreenShotHelper.MaxWindow((Window)this.View);
 }