- SharpShell_Tools.zip
- Apex.dll
- Apex.WinForms.dll
- ServerInspector.exe
- ServerManager.exe
- SharpShell.dll
- SharpShell_Core_Library.zip
- SharpShell_Source_Code.zip
- SharpShell Source Code
- Dependencies
- Apex
- Apex.WinForms.dll
- SharpShell
- Info.txt
- packages
- Apex.1.5.0
- Apex.1.5.0.nupkg
- lib
- net35
- Apex.dll
- net40
- Apex.dll
- sl30
- Apex.Silverlight.dll
- sl3-wp
- Apex.WP7.dll
- sl40
- Apex.Silverlight4.dll
- sl4-wp71
- Apex.WP7.dll
- sl50
- Apex.Silverlight.dll
- ILMerge.2.12.0803
- ILMerge.2.12.0803.nupkg
- ILMerge.doc
- ILMerge.exe
- NUnit.2.6.2
- repositories.config
- Samples
- ContextMenu
- ContextMenuComponent
- Properties
- ContextMenuSample
- Properties
- CountLinesExtension
- DllContextMenuExtension
- IsolatedContextMenuComponent
- Diagnostics
- Interop
- Properties
- ServerRegistration
- SharpContextMenu
- DropHandler
- XsdDropHandler
- IconHandler
- DllIconHandler
- IconOverlayHandler
- ReadOnlyFileIconOverlayHandler
- InfoTipHandler
- FolderInfoTipHandler
- PreviewHandler
- IconPreviewHandler
- PropertySheet
- DrivePropertySheet
- ResourcesPropertySheet
- TextFilePropertySheet
- SharedAssemblyInfo.cs
- SharpShell.sln
- SharpShell
- SharpShellNativeBridge
- Todo.txt
- Tools
- ExtensionManager
- Properties
- Resources
- xsd.ico
- ServerInspector
- ServerManager
- ShellExtensionManager
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using SharpShell.Attributes;
using SharpShell.SharpInfoTipHandler;
namespace FolderInfoTipHandler
{
/// <summary>
/// The FolderInfoTip handler is an example SharpInfoTipHandler that provides an info tip
/// for folders that shows the number of items in the folder.
/// </summary>
[ComVisible(true)]
[COMServerAssociation(AssociationType.Directory)]
public class FolderInfoTipHandler : SharpInfoTipHandler
{
/// <summary>
/// Gets info for the selected item (SelectedItemPath).
/// </summary>
/// <param name="infoType">Type of info to return.</param>
/// <param name="singleLine">if set to <c>true</c>, put the info in a single line.</param>
/// <returns>
/// Specified info for the selected file.
/// </returns>
protected override string GetInfo(RequestedInfoType infoType, bool singleLine)
{
// Switch on the tip of info we need to provide.
switch (infoType)
{
case RequestedInfoType.InfoTip:
// Format the formatted info tip.
return string.Format(singleLine
? "{0} - {1} Items"
: "{0}" + Environment.NewLine + "Contains {1} Items",
Path.GetFileName(SelectedItemPath), Directory.GetFiles(SelectedItemPath).Length);
case RequestedInfoType.Name:
// Return the name of the folder.
return string.Format("Folder '{0}'", Path.GetFileName(SelectedItemPath));
default:
// We won't be asked for anything else, like shortcut paths, for folders, so we
// can return an empty string in the default case.
return string.Empty;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.