private void Screenshot_DuplicateFileFound(object sender, DuplicateFileEventArgs e) { Trace.WriteLine("Duplicate file found: " + e.DuplicateFileName); using (var dialog = new Dialogs.DuplicateFileFoundDialog( e.TargetFileName, e.DuplicateFileName)) { var result = dialog.ShowDialog(); switch (result) { case DialogResult.Ignore: e.Action = DuplicateFileAction.Ignore; break; case DialogResult.Yes: e.Action = DuplicateFileAction.Replace; break; case DialogResult.Abort: default: e.Action = DuplicateFileAction.Abort; break; } } }
/// <summary> /// Raises the <see cref="DuplicateFileFound"/> event. /// </summary> protected virtual void OnDuplicateFileFound(DuplicateFileEventArgs arg) { var handler = DuplicateFileFound; if (handler != null) { handler(this, arg); } }