ShellObjectBase Class
Provides an abstract base class for an IShellObject implementation.
public abstract class ShellObjectBase : DisposableObjectBase, IShellObject, IDisposable
- Inheritance:
- object DisposableObjectBase object
- Derived:
- ShellObjectWrapper
- Implements:
- IShellObject IDisposable
Constructors
ShellObjectBase(IShellService)
Initializes an instance of the ShellObjectBase class.
protected ShellObjectBase(IShellService shellService)
Parameter | Type | Description |
---|---|---|
shellService | IShellService | The IShellService used to return this shell object's children. |
Properties
AreChildrenLoaded
Gets whether the Children collection is loaded.
public virtual bool AreChildrenLoaded { get; }
Property Value
Remarks
Since the Children collection is lazy-loaded when called, this property returns whether it has been loaded without triggering a load.
CanCreateChildFolder
Gets whether the shell object can create a child folder.
public virtual bool CanCreateChildFolder { get; }
Property Value
- bool:
true
if the shell object can create a child folder; otherwise,false
. The default implementation of this property returnsfalse
.
Remarks
Only shell folders can create child folders.
CanHaveChildFolders
Gets whether the shell object may have child folders.
public virtual bool CanHaveChildFolders { get; }
Property Value
- bool:
true
if the shell object may have child folders; otherwise,false
. The default implementation of this property returns the IsFolder property value.
Remarks
Some shell objects can immediately return that they don't have any child folders, whereas others might require a query to determine if there are any.
CanRename
Gets whether the shell object may be renamed.
public virtual bool CanRename { get; }
Property Value
- bool:
true
if the shell object may be renamed; otherwise,false
. The default implementation of this property returnsfalse
.
Children
Gets the collection of child shell objects using lazy-loading.
public virtual IList<IShellObject> Children { get; }
Property Value
- IList<IShellObject>:
The collection of child shell objects using lazy-loading.
EditingName
Gets the full user-friendly editing name of the shell object, if available.
public virtual string EditingName { get; }
Property Value
- string:
The full user-friendly editing name of the shell object, if available.
Remarks
This value is usually the same as FileSystemPath, except that it can also return a special value to identify special shell objects.
ExtraLargeIcon
Gets or sets the extra-large icon.
public abstract ImageSource ExtraLargeIcon { get; set; }
Property Value
- ImageSource:
The extra-large icon.
ExtraLargeIconOverlay
Gets or sets the extra-large icon overlay.
public abstract ImageSource ExtraLargeIconOverlay { get; set; }
Property Value
- ImageSource:
The extra-large icon overlay.
ExtraLargeThumbnail
Gets or sets the extra-large thumbnail.
public abstract ImageSource ExtraLargeThumbnail { get; set; }
Property Value
- ImageSource:
The extra-large thumbnail.
FileSystemPath
Gets the file system path of the shell object, if available.
public virtual string FileSystemPath { get; }
Property Value
- string:
The file system path of the shell object, if available. The default implementation of this property returns
null
.
IsFolder
Gets whether the shell object is a folder, which is anything that can contain other shell objects.
public virtual bool IsFolder { get; }
Property Value
IsLink
Gets whether the shell object is a link, meaning a shortcut to another shell object.
public virtual bool IsLink { get; }
Property Value
IsRemovable
Gets whether the shell object is on removable media or is a removable device.
public virtual bool IsRemovable { get; }
Property Value
- bool:
true
if the shell object is on removable media or is a removable device; otherwise,false
. The default implementation of this property returnsfalse
.
IsVirtual
Gets whether the shell object is not part of the file system (files, directories, or root directories).
public virtual bool IsVirtual { get; }
Property Value
- bool:
true
if the shell object is not part of the file system (files, directories, or root directories); otherwise,false
. The default implementation of this property returnstrue
.
IsWatching
Gets whether the shell object's tree hierarchy is currently watching for change notifications.
public virtual bool IsWatching { get; }
Property Value
- bool:
true
if the shell object's tree hierarchy is currently watching for change notifications; otherwise,false
. The default implementation of this property returnsfalse
.
Kind
Gets a ShellObjectKind that specifies the kind of this shell object.
public abstract ShellObjectKind Kind { get; }
Property Value
- ShellObjectKind:
A ShellObjectKind that specifies the kind of this shell object.
LargeIcon
Gets or sets the large icon.
LargeIconOverlay
Gets or sets the large icon overlay.
public abstract ImageSource LargeIconOverlay { get; set; }
Property Value
- ImageSource:
The large icon overlay.
LargeThumbnail
Gets or sets the large thumbnail.
public abstract ImageSource LargeThumbnail { get; set; }
Property Value
- ImageSource:
The large thumbnail.
MediumIcon
Gets or sets the medium icon.
MediumIconOverlay
Gets or sets the medium icon overlay.
public abstract ImageSource MediumIconOverlay { get; set; }
Property Value
- ImageSource:
The medium icon overlay.
MediumThumbnail
Gets or sets the medium thumbnail.
public abstract ImageSource MediumThumbnail { get; set; }
Property Value
- ImageSource:
The medium thumbnail.
Name
Gets or sets the name of the shell object.
ParsingName
Gets the full parsing name of the shell object, if available.
public virtual string ParsingName { get; }
Property Value
- string:
The full parsing name of the shell object, if available. The default implementation of this property returns the FileSystemPath property value.
Remarks
This value is usually the same as FileSystemPath, except that it can also return a special syntax to identify special shell objects.
RelativeParsingName
Gets the parent-relative parsing name of the shell object, if available.
public virtual string RelativeParsingName { get; }
Property Value
- string:
The parent-relative parsing name of the shell object, if available.
Remarks
This value is usually the same as Name, except that it can also return a special syntax to identify special shell objects.
ShellService
Gets the IShellService used to return this shell object's children.
public IShellService ShellService { get; }
Property Value
- IShellService:
The IShellService used to return this shell object's children.
SmallIcon
Gets or sets the small icon.
SmallIconOverlay
Gets or sets the small icon overlay.
public abstract ImageSource SmallIconOverlay { get; set; }
Property Value
- ImageSource:
The small icon overlay.
SortOrder
Gets or sets a numeric sort order for sorting the shell object within other shell objects.
public virtual int SortOrder { get; set; }
Property Value
- int:
A numeric sort order for sorting the shell object within other shell objects. The default value is
0
.
SpecialFolderKind
Gets a SpecialFolderKind that specifies kind of special folder represented by this shell object, if applicable.
public virtual SpecialFolderKind SpecialFolderKind { get; }
Property Value
- SpecialFolderKind:
A SpecialFolderKind that specifies kind of special folder represented by this shell object, if applicable. The default implementation of this property returns
None
.
ToolTip
Gets or sets the tool-tip object that is displayed for this shell object in the user interface (UI).
Methods
CreateChildFolder(string)
Creates a child folder with the specified name.
public virtual bool CreateChildFolder(string name)
Parameter | Type | Description |
---|---|---|
name | string | The name of the child folder. |
Returns
- bool:
true
if the child folder was created; otherwise,false
.
Remarks
Only shell folders can create child folders.
The default implementation of this method does nothing and returns false
.
Dispose(bool)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
protected override void Dispose(bool disposing)
Parameter | Type | Description |
---|---|---|
disposing | bool |
|
Remarks
This method is called by the public Dispose
method and the Finalize
method.
Dispose
invokes this method with the disposing
parameter set to true
.
Finalize
invokes this method with disposing
set to false
.
GetChildComparisonKey(IShellObject)
Returns the comparison key object to use for an IShellObject in the RefreshChildren() method when it looks for existing shell objects.
protected virtual object GetChildComparisonKey(IShellObject shellObject)
Parameter | Type | Description |
---|---|---|
shellObject | IShellObject | The IShellObject to examine. |
Returns
- object:
The comparison key object to use.
NotifyPropertyChanged(string)
Notifies that a property has changed.
protected void NotifyPropertyChanged(string propertyName)
Parameter | Type | Description |
---|---|---|
propertyName | string | The name of the property that was changed. |
RaiseChangedEvent(ShellObjectChangedEventArgs)
Raises the Changed event.
protected void RaiseChangedEvent(ShellObjectChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | ShellObjectChangedEventArgs | The |
RaisePropertyChangedEvent(PropertyChangedEventArgs)
Raises the PropertyChanged event.
protected void RaisePropertyChangedEvent(PropertyChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | PropertyChangedEventArgs | The PropertyChangedEventArgs that contains the event data. |
RefreshChildren()
Refreshes the Children collection.
public virtual void RefreshChildren()
StartWatching()
Starts watching the shell object's tree hierarchy for change notifications.
public virtual bool StartWatching()
Returns
- bool:
true
if the shell object is watching its tree hierarchy; otherwise,false
.
Remarks
The default implementation of this method does nothing, and returns false
.
StopWatching()
Stops watching the shell object's tree hierarchy for change notifications.
public virtual void StopWatching()
Remarks
The default implementation of this method does nothing.
ToString()
Returns a String
that represents the current Object
.
Events
Changed
Occurs when the shell object has changed.
public event EventHandler<ShellObjectChangedEventArgs> Changed
Event Type
PropertyChanged
Occurs when a property has been changed.