static void Shot(MainViewModel ViewModel, ShotCmdOptions ShotOptions) { ViewModel.Settings.IncludeCursor = ShotOptions.Cursor; // Screenshot Window with Transparency if (ShotOptions.Source != null && Regex.IsMatch(ShotOptions.Source, @"win:\d+")) { var ptr = int.Parse(ShotOptions.Source.Substring(4)); try { var bmp = ViewModel.ScreenShotWindow(new Window(new IntPtr(ptr))); ViewModel.SaveScreenShot(bmp, ShotOptions.FileName).Wait(); } catch { // Suppress Errors } } else { HandleVideoSource(ViewModel, ShotOptions); ViewModel.CaptureScreenShot(ShotOptions.FileName); } }