void MoveContent(object sender, ElapsedEventArgs e) { timer.Enabled = false; timer.Stop(); string d = ""; caller.Dispatcher.Invoke(new Action(delegate { try { FileMover fm = new FileMover(); foreach (string dir in directoriesToMove) { d = dir; fm.Copy(dir, DestinationFolder, caller); } directoriesToMove.Clear(); } catch (Exception ex) { caller.Dispatcher.Invoke(new Action(() => Globals.Errors.Add(new Error { Description = ex.Message, Dest = DestinationFolder, Source = d }))); } })); }
private void RetryAction(object sender, MouseButtonEventArgs e) { Dispatcher.Invoke(new Action(delegate { try { FileMover fm = new FileMover(); Error er = Errors[ErrorList.SelectedIndex]; fm.Copy(er.Source, er.Dest, this); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace, "Error!", MessageBoxButton.OK, MessageBoxImage.Error); } })); }