public ShellItemUpdateEventArgs( ShellItem oldItem, ShellItem newItem, ShellItemUpdateType type) { this.oldItem = oldItem; this.newItem = newItem; this.type = type; }
public void Update(IntPtr newPidlFull, ShellItemUpdateType changeType) { Browser.UpdateCondition.ContinueUpdate = false; lock (Browser) { #region Change Pidl and ShellFolder if (newPidlFull != IntPtr.Zero) { IntPtr tempPidl = Pidl.ILClone(Pidl.ILFindLastID(newPidlFull)), newPidlRel, newShellFolderPtr; Shell32.SHGetRealIDL(ParentItem.ShellFolder, tempPidl, out newPidlRel); if (IsFolder && ParentItem.ShellFolder.BindToObject(newPidlRel, IntPtr.Zero, ref ShellGuids.IShellFolder, out newShellFolderPtr) == 0) { Marshal.ReleaseComObject(shellFolder); Marshal.Release(shellFolderPtr); PIDLRel.Free(); shellFolderPtr = newShellFolderPtr; shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder)); PIDLRel = new Pidl(newPidlRel, false); foreach (ShellNode child in SubFolders) { UpdateShellFolders(child); } } else { PIDLRel.Free(); PIDLRel = new Pidl(newPidlRel, false); } Marshal.FreeCoTaskMem(tempPidl); Marshal.FreeCoTaskMem(newPidlFull); } #endregion #region Make Other Changes switch (changeType) { case ShellItemUpdateType.Renamed: SetText(this); SetPath(this); break; case ShellItemUpdateType.Updated: if (IsFolder) { SetAttributesFolder(this); } else { SetAttributesFile(this); } break; case ShellItemUpdateType.MediaChange: SetInfo(this); Clear(true, true); break; case ShellItemUpdateType.IconChange: SetInfo(this); break; } #endregion } Browser.OnShellItemUpdate(ParentItem, new ShellItemUpdateEventArgs(this, this, changeType)); }
internal void Update(IntPtr newPidlFull, ShellItemUpdateType changeType) { browser.UpdateCondition.ContinueUpdate = false; lock (browser) { #region Change Pidl and ShellFolder if (newPidlFull != IntPtr.Zero) { IntPtr tempPidl = PIDL.ILClone(PIDL.ILFindLastID(newPidlFull)), newPidlRel, newShellFolderPtr; ShellAPI.SHGetRealIDL(ParentItem.ShellFolder, tempPidl, out newPidlRel); if (IsFolder && ParentItem.ShellFolder.BindToObject( newPidlRel, IntPtr.Zero, ref ShellAPI.IID_IShellFolder, out newShellFolderPtr) == ShellAPI.S_OK) { Marshal.ReleaseComObject(shellFolder); Marshal.Release(shellFolderPtr); pidlRel.Free(); shellFolderPtr = newShellFolderPtr; shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder)); pidlRel = new PIDL(newPidlRel, false); foreach (ShellItem child in SubFolders) UpdateShellFolders(child); } else { pidlRel.Free(); pidlRel = new PIDL(newPidlRel, false); } Marshal.FreeCoTaskMem(tempPidl); //VORSICHT - von MW auskommentiert 20.07.12 //Marshal.FreeCoTaskMem(newPidlFull); } #endregion #region Make Other Changes switch (changeType) { case ShellItemUpdateType.Renamed: SetText(this); SetPath(this); break; case ShellItemUpdateType.Updated: if (IsFolder) SetAttributesFolder(this); else SetAttributesFile(this); break; case ShellItemUpdateType.MediaChange: SetInfo(this); Clear(true, true); break; case ShellItemUpdateType.IconChange: SetInfo(this); break; } #endregion } Browser.OnShellItemUpdate(ParentItem, new ShellItemUpdateEventArgs(this, this, changeType)); }
internal void Update(IntPtr newPidlFull, ShellItemUpdateType changeType) { browser.UpdateCondition.ContinueUpdate = false; lock (browser) { #region Change Pidl and ShellFolder // Закомментированный ниже код выдает ошибку, связанную с ненахождением // точки входа SHGetRealIDL в shell32.dll (возникала при переименовывании // файла через оболочку браузера) /* if (newPidlFull != IntPtr.Zero) { IntPtr tempPidl = PIDL.ILClone(PIDL.ILFindLastID(newPidlFull)), newPidlRel, newShellFolderPtr; ShellAPI.SHGetRealIDL(ParentItem.ShellFolder, tempPidl, out newPidlRel); if (IsFolder && ParentItem.ShellFolder.BindToObject( newPidlRel, IntPtr.Zero, ref ShellAPI.IID_IShellFolder, out newShellFolderPtr) == ShellAPI.S_OK) { Marshal.ReleaseComObject(shellFolder); Marshal.Release(shellFolderPtr); pidlRel.Free(); shellFolderPtr = newShellFolderPtr; shellFolder = (IShellFolder)Marshal.GetTypedObjectForIUnknown(shellFolderPtr, typeof(IShellFolder)); pidlRel = new PIDL(newPidlRel, false); foreach (ShellItem child in SubFolders) UpdateShellFolders(child); } else { pidlRel.Free(); pidlRel = new PIDL(newPidlRel, false); } Marshal.FreeCoTaskMem(tempPidl); Marshal.FreeCoTaskMem(newPidlFull); } */ #endregion #region Make Other Changes switch (changeType) { case ShellItemUpdateType.Renamed: SetText(this); SetPath(this); break; case ShellItemUpdateType.Updated: if (IsFolder) SetAttributesFolder(this); else SetAttributesFile(this); break; case ShellItemUpdateType.MediaChange: SetInfo(this); Clear(true, true); break; case ShellItemUpdateType.IconChange: SetInfo(this); break; } #endregion } Browser.OnShellItemUpdate(ParentItem, new ShellItemUpdateEventArgs(this, this, changeType)); }
public ShellItemUpdateEventArgs(ShellNode oldItem, ShellNode newItem, ShellItemUpdateType type) { this.OldItem = oldItem; this.NewItem = newItem; this.UpdateType = type; }