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; }
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); } }