private void CaptureButton_Click(object sender, RoutedEventArgs e) { // save coordinates of 'content grid' System.Windows.Point locationFromScreen = ContentGrid.PointToScreen(new System.Windows.Point(0, 0)); contentGrid_X = locationFromScreen.X; contentGrid_Y = locationFromScreen.Y; contentGrid_Width = ContentGrid.ActualWidth; contentGrid_Height = ContentGrid.ActualHeight; // hide window this.WindowState = WindowState.Minimized; // wait some seconds timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(2); timer.Tick += (paramSender, paramArgs) => { timer.Stop(); Thread t = new Thread(new ThreadStart(StartProcessing)); Stop = false; t.Start(); }; timer.Start(); }