/// <summary> /// Create a new FileOperation object that will perform all queued operations when disposed. /// </summary> /// <param name="owner">Owner of the file operations</param> public FileOperation(IWin32Window owner) { _fileOperation = (IFileOperation)Activator.CreateInstance(_fileOperationType); _fileOperation.SetOperationFlags(FileOperationFlags.FOF_NOCONFIRMMKDIR); if(owner != null) _fileOperation.SetOwnerWindow((uint)owner.Handle); }
public FileOperation(FileOperationProgressSink callbackSink, IWin32Window owner) { _callbackSink = callbackSink; _fileOperation = (IFileOperation) Activator.CreateInstance(_fileOperationType); _fileOperation.SetOperationFlags(FileOperationFlags.FOF_NOCONFIRMMKDIR); if (_callbackSink != null) SinkCookie = _fileOperation.Advise(_callbackSink); if (owner != null) _fileOperation.SetOwnerWindow((uint) owner.Handle); }
/// <summary>Initializes a new instance of the <see cref="ShellFileOperations"/> class.</summary> /// <param name="owner">The window that owns the modal dialog. This value can be <see langword="null"/>.</param> public ShellFileOperations(IWin32Window owner = null) { op = new IFileOperation(); if (owner != null) { op.SetOwnerWindow(owner.Handle); } sink = new OpSink(this); sinkCookie = op.Advise(sink); }
/// <summary>Initializes a new instance of the <see cref="ShellFileOperations"/> class.</summary> /// <param name="owner">The window that owns the modal dialog. This value can be <see langword="null"/>.</param> public ShellFileOperations(HWND owner = default) { op = new IFileOperation(); if (owner != default) { op.SetOwnerWindow(owner); } sink = new OpSink(this); sinkCookie = op.Advise(sink); }
/// <summary> /// Create a new FileOperation object that will perform all queued operations when disposed. /// </summary> /// <param name="owner">Owner of the file operations.</param> public CopyFilesOperation(IWin32Window owner) { _fileOperation = (IFileOperation)Activator.CreateInstance(_fileOperationType); _fileOperation.SetOperationFlags(FileOperationFlags.FOF_NOCONFIRMMKDIR); if (owner != null) { _fileOperation.SetOwnerWindow((uint)owner.Handle); } _shellItemFactory = new ShellItemFactory(); }
public void SetOwnerWindow(IntPtr hwndOwner) { if (disposed) { throw new ObjectDisposedException(nameof(FileOperation)); } HResult hr = fileOperation.SetOwnerWindow(hwndOwner); if (!CoreErrorHelper.Succeeded(hr)) { Marshal.ThrowExceptionForHR((int)hr); } }
public FileOperation(FileOperationProgressSink callbackSink, IWin32Window owner) { _callbackSink = callbackSink; _fileOperation = (IFileOperation)Activator.CreateInstance(_fileOperationType); _fileOperation.SetOperationFlags(FileOperationFlags.FOF_NOCONFIRMMKDIR); if (_callbackSink != null) { SinkCookie = _fileOperation.Advise(_callbackSink); } if (owner != null) { _fileOperation.SetOwnerWindow((uint)owner.Handle); } }
public IIFileOperation(FileOperationProgressSink callbackSink, IntPtr owner, Boolean isRecycle, Boolean isCopyInSameFolder) { this._CallbackSink = callbackSink; this._IsCopyInSameFolder = isCopyInSameFolder; _FileOperation = (IFileOperation)Activator.CreateInstance(_FileOperationType); if (!isRecycle) { this._FileOperation.SetOperationFlags(FileOperationFlags.FOF_NOCONFIRMMKDIR); } if (_CallbackSink != null) { _SinkCookie = _FileOperation.Advise(_CallbackSink); } if (owner != IntPtr.Zero) { _FileOperation.SetOwnerWindow((uint)owner); } }
public FileOperation() { fileOperation = (IFileOperation)Activator.CreateInstance(fileOperationType); fileOperation.SetOperationFlags(FileOperationFlags.FOF_NOCONFIRMMKDIR); fileOperation.SetOwnerWindow(SafeNativeMethods.GetActiveWindowHandle()); }
public FileOperation() { fileOperation = (IFileOperation)Activator.CreateInstance(typeof(CFileOperations)); fileOperation.SetOperationFlags(FILEOP_FLAGS.FOF_NOCONFIRMMKDIR); fileOperation.SetOwnerWindow(SafeNativeMethods.GetActiveWindowHandle()); }