public void Process(object sender, CapturedScreenshotEventArgs image)
        {
            EventHandler<CapturedScreenshotEventArgs> actionWhite = (s, e) =>
            {
                _white = GetScreenshot();

                _effectBackgroundBlack.Process(this, image);
            };

            EventHandler<CapturedScreenshotEventArgs> actionBlack = (s2, e2) =>
            {
                _black = GetScreenshot();

                OnBothFiltered(new CapturedScreenshotEventArgs(null));
            };

            _effectBackground.Filtered += actionWhite;
            _effectBackground.Process(this, image);

            _effectBackgroundBlack = new EffectBackground(_effectBackground.X, _effectBackground.Y, _effectBackground.Width, _effectBackground.Height);
            _effectBackgroundBlack.SetBackground(new SolidColorBrush(Colors.Black));
            _effectBackgroundBlack.Filtered += actionBlack;

            this.BothFiltered += ProcessTransparency;
        }
Esempio n. 2
0
        public void Process(object sender, CapturedScreenshotEventArgs image)
        {
            _background.Visibility = Visibility.Visible;
            _background.SetDimensions(_x, _y, _width, _height);

            _background.ContentRendered += (s, e) =>
                {
                    OnFiltered(null);

                    _background.Close();
                    _background = null;
                };
        }
Esempio n. 3
0
        public void Process(object sender, CapturedScreenshotEventArgs image)
        {
            EventHandler<CapturedScreenshotEventArgs> action = (s, e) =>
                {
                    _window.BringToTop();

                    Thread.Sleep(100);

                    var result = _fs.TakeAScreenshot(_x, _y, _width, _height);

                    OnFiltered(new CapturedScreenshotEventArgs(result));
                };

            if (_effectBackground != null)
            {
                _effectBackground.Filtered += action;
                _effectBackground.Process(this, image);
            }
            else
            {
                action(this, image);
            }
        }
 private void ProcessTransparency(object sender, CapturedScreenshotEventArgs image)
 {
     var transparency = new TransparencyCalc(_white, _black);
     var transparent = transparency.GetTransparent();
     OnFiltered(new CapturedScreenshotEventArgs(transparent));
 }
 public void OnFiltered(CapturedScreenshotEventArgs e)
 {
     EventHandler<CapturedScreenshotEventArgs> handler = this.Filtered;
     if (handler != null)
         handler(this, e);
 }
Esempio n. 6
0
 protected void OnCaptured(CapturedScreenshotEventArgs e)
 {
     EventHandler<CapturedScreenshotEventArgs> handler = this.Captured;
     if (handler != null)
         handler(this, e);
 }