示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <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);
            }
        }
示例#3
0
 /// <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)
 {
 }
示例#4
0
 /// <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)
 {
 }