Table of Contents

Class ShellObjectWatcher

Namespace
Microsoft.WindowsAPICodePack.Shell
Assembly
Microsoft.WindowsAPICodePack.Shell.dll

Listens for changes in/on a ShellObject and raises events when they occur. This class supports all items under the shell namespace including files, folders and virtual folders (libraries, search results and network items), etc.

public class ShellObjectWatcher : IDisposable
Inheritance
ShellObjectWatcher
Implements
Inherited Members

Constructors

ShellObjectWatcher(ShellObject, bool)

Creates the ShellObjectWatcher for the given ShellObject

public ShellObjectWatcher(ShellObject shellObject, bool recursive)

Parameters

shellObject ShellObject

The ShellObject to monitor

recursive bool

Whether to listen for changes recursively (for when monitoring a container)

Properties

Running

Gets whether the watcher is currently running.

public bool Running { get; }

Property Value

bool

Methods

Dispose()

Disposes ShellObjectWatcher.

public void Dispose()

Dispose(bool)

Disposes ShellObjectWatcher

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~ShellObjectWatcher()

Finalizer for ShellObjectWatcher

protected ~ShellObjectWatcher()

ProcessChangeNotificationEvent(WindowMessageEventArgs)

Processes all change notifications sent by the Windows Shell.

protected virtual void ProcessChangeNotificationEvent(WindowMessageEventArgs e)

Parameters

e WindowMessageEventArgs

The windows message representing the notification event

Start()

Start the watcher and begin receiving change notifications.
If the watcher is running, has no effect. Registration for notifications should be done before this is called.

public void Start()

Stop()

Stop the watcher and prevent further notifications from being received. If the watcher is not running, this has no effect.

public void Stop()

Events

AllEvents

Raised when any event occurs.

public event EventHandler<ShellObjectNotificationEventArgs> AllEvents

Event Type

EventHandler<ShellObjectNotificationEventArgs>

DirectoryCreated

Raised when a directory is created.

public event EventHandler<ShellObjectChangedEventArgs> DirectoryCreated

Event Type

EventHandler<ShellObjectChangedEventArgs>

DirectoryDeleted

Raised when a directory is deleted.

public event EventHandler<ShellObjectChangedEventArgs> DirectoryDeleted

Event Type

EventHandler<ShellObjectChangedEventArgs>

DirectoryRenamed

Raised when a directory is renamed.

public event EventHandler<ShellObjectRenamedEventArgs> DirectoryRenamed

Event Type

EventHandler<ShellObjectRenamedEventArgs>

DirectoryUpdated

Raised when a directory is updated.

public event EventHandler<ShellObjectChangedEventArgs> DirectoryUpdated

Event Type

EventHandler<ShellObjectChangedEventArgs>

DiskEvents

Raised when disk events occur.

public event EventHandler<ShellObjectNotificationEventArgs> DiskEvents

Event Type

EventHandler<ShellObjectNotificationEventArgs>

DriveAdded

Raised when a drive is added.

public event EventHandler<ShellObjectChangedEventArgs> DriveAdded

Event Type

EventHandler<ShellObjectChangedEventArgs>

DriveRemoved

Raised when a drive is removed.

public event EventHandler<ShellObjectChangedEventArgs> DriveRemoved

Event Type

EventHandler<ShellObjectChangedEventArgs>

FileTypeAssociationChanged

Raised when a file type association changes.

public event EventHandler<ShellObjectChangedEventArgs> FileTypeAssociationChanged

Event Type

EventHandler<ShellObjectChangedEventArgs>

FolderNetworkShared

Raised when a folder is shared on a network.

public event EventHandler<ShellObjectChangedEventArgs> FolderNetworkShared

Event Type

EventHandler<ShellObjectChangedEventArgs>

FolderNetworkUnshared

Raised when a folder is unshared from the network.

public event EventHandler<ShellObjectChangedEventArgs> FolderNetworkUnshared

Event Type

EventHandler<ShellObjectChangedEventArgs>

FreeSpaceChanged

Raised when free space changes.

public event EventHandler<ShellObjectChangedEventArgs> FreeSpaceChanged

Event Type

EventHandler<ShellObjectChangedEventArgs>

GlobalEvents

Raised when global events occur.

public event EventHandler<ShellObjectNotificationEventArgs> GlobalEvents

Event Type

EventHandler<ShellObjectNotificationEventArgs>

ItemCreated

Raised when an item is created.

public event EventHandler<ShellObjectChangedEventArgs> ItemCreated

Event Type

EventHandler<ShellObjectChangedEventArgs>

ItemDeleted

Raised when an item is deleted.

public event EventHandler<ShellObjectChangedEventArgs> ItemDeleted

Event Type

EventHandler<ShellObjectChangedEventArgs>

ItemRenamed

Raised when an item is renamed.

public event EventHandler<ShellObjectRenamedEventArgs> ItemRenamed

Event Type

EventHandler<ShellObjectRenamedEventArgs>

MediaInserted

Raised when media is inserted.

public event EventHandler<ShellObjectChangedEventArgs> MediaInserted

Event Type

EventHandler<ShellObjectChangedEventArgs>

MediaRemoved

Raised when media is removed.

public event EventHandler<ShellObjectChangedEventArgs> MediaRemoved

Event Type

EventHandler<ShellObjectChangedEventArgs>

ServerDisconnected

Raised when a server is disconnected.

public event EventHandler<ShellObjectChangedEventArgs> ServerDisconnected

Event Type

EventHandler<ShellObjectChangedEventArgs>

SystemImageChanged

Raised when a system image is changed.

public event EventHandler<ShellObjectChangedEventArgs> SystemImageChanged

Event Type

EventHandler<ShellObjectChangedEventArgs>

Updated

Raised when an item is updated.

public event EventHandler<ShellObjectChangedEventArgs> Updated

Event Type

EventHandler<ShellObjectChangedEventArgs>