/// <summary> /// Initializes a new instance of the <see cref="FileOperation"/> class. /// </summary> /// <param name="callbackSink"> /// The callback sink. /// </param> /// <param name="owner"> /// The owner. /// </param> public FileOperation(FileOperationProgressSink callbackSink, IWin32Window owner) { this.callbackSink = callbackSink; this.fileOperation = (IFileOperation)Activator.CreateInstance(FileOperationType); this.fileOperation.SetOperationFlags(FileOperationFlags.FOF_NOCONFIRMMKDIR | FileOperationFlags.FOF_SILENT | FileOperationFlags.FOFX_SHOWELEVATIONPROMPT | FileOperationFlags.FOFX_NOCOPYHOOKS | FileOperationFlags.FOFX_REQUIREELEVATION); if (this.callbackSink != null) { this.sinkCookie = this.fileOperation.Advise(this.callbackSink); } if (owner != null) { this.fileOperation.SetOwnerWindow((uint)owner.Handle); } }
/// <summary> /// Initializes a new instance of the <see cref="FileOperation"/> class. /// </summary> /// <param name="callbackSink"> /// The callback sink. /// </param> public FileOperation(FileOperationProgressSink callbackSink) : this(callbackSink, null) { }