C# Класс JWC.MruStripMenu

Represents a most recently used (MRU) menu.
This class shows the MRU list in a popup menu. To display the MRU list "inline" use .

The class will optionally load the last set of files from the registry on construction and store them when instructed by the main program.

Internally, this class uses zero-based numbering for the items. The displayed numbers, however, will start with one.

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
maxEntries int
maxShortenPathLength int
mruStripMutex System.Threading.Mutex
numEntries int
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
registryKeyName string

Открытые методы

Метод Описание
AddFile ( string filename ) : void
AddFile ( string filename, string entryname ) : void
AddFiles ( string filenames ) : void
FindFilenameMenuIndex ( string filename ) : int

Returns the menu index of the passed filename.

FindFilenameNumber ( string filename ) : int

Returns the entry number matching the passed filename.

FixupEntryname ( int number, string entryname ) : string
GetFileAt ( int number ) : string
GetFiles ( ) : string[]
GetFilesFullEntrystring ( ) : string[]
GetMenuIndex ( int number ) : int

Returns the menu index for a specified MRU item number.

LoadFromRegistry ( ) : void
LoadFromRegistry ( string keyName ) : void
MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler ) : System

Initializes a new instance of the MruMenu class.

MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, int maxEntries ) : System

Initializes a new instance of the MruMenu class.

MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName ) : System

Initializes a new instance of the MruMenu class.

MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, bool loadFromRegistry ) : System

Initializes a new instance of the MruMenu class.

MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, bool loadFromRegistry, int maxEntries ) : System

Initializes a new instance of the MruMenu class.

MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, int maxEntries ) : System

Initializes a new instance of the MruMenu class.

RemoveAll ( ) : void
RemoveFile ( int number ) : void
RemoveFile ( string filename ) : void
RenameFile ( string oldFilename, string newFilename ) : void
RenameFile ( string oldFilename, string newFilename, string newEntryname ) : void
SaveToRegistry ( ) : void
SaveToRegistry ( string keyName ) : void
SetFiles ( string filenames ) : void
SetFirstFile ( int number ) : void
ShortenPathname ( string pathname, int maxLength ) : string

Shortens a pathname for display purposes.

Shortens a pathname by either removing consecutive components of a path and/or by removing characters from the end of the filename and replacing then with three elipses (...)

In all cases, the root of the passed path will be preserved in it's entirety.

If a UNC path is used or the pathname and maxLength are particularly short, the resulting path may be longer than maxLength.

This method expects fully resolved pathnames to be passed to it. (Use Path.GetFullPath() to obtain this.)

Защищенные методы

Метод Описание
Disable ( ) : void
Enable ( ) : void
FixupPrefixes ( int startNumber ) : void
Init ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, bool loadFromRegistry, int maxEntries ) : void
MruStripMenu ( ) : System
OnClick ( object sender, System e ) : void
SetFirstFile ( MruMenuItem menuItem ) : void

Описание методов

AddFile() публичный Метод

public AddFile ( string filename ) : void
filename string
Результат void

AddFile() публичный Метод

public AddFile ( string filename, string entryname ) : void
filename string
entryname string
Результат void

AddFiles() публичный Метод

public AddFiles ( string filenames ) : void
filenames string
Результат void

Disable() защищенный Метод

protected Disable ( ) : void
Результат void

Enable() защищенный Метод

protected Enable ( ) : void
Результат void

FindFilenameMenuIndex() публичный Метод

Returns the menu index of the passed filename.
public FindFilenameMenuIndex ( string filename ) : int
filename string The filename to search for.
Результат int

FindFilenameNumber() публичный Метод

Returns the entry number matching the passed filename.
public FindFilenameNumber ( string filename ) : int
filename string The filename to search for.
Результат int

FixupEntryname() публичный статический Метод

public static FixupEntryname ( int number, string entryname ) : string
number int
entryname string
Результат string

FixupPrefixes() защищенный Метод

protected FixupPrefixes ( int startNumber ) : void
startNumber int
Результат void

GetFileAt() публичный Метод

public GetFileAt ( int number ) : string
number int
Результат string

GetFiles() публичный Метод

public GetFiles ( ) : string[]
Результат string[]

GetFilesFullEntrystring() публичный Метод

public GetFilesFullEntrystring ( ) : string[]
Результат string[]

GetMenuIndex() публичный Метод

Returns the menu index for a specified MRU item number.
public GetMenuIndex ( int number ) : int
number int The MRU item number.
Результат int

Init() защищенный Метод

protected Init ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, bool loadFromRegistry, int maxEntries ) : void
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
clickedHandler ClickedHandler
registryKeyName string
loadFromRegistry bool
maxEntries int
Результат void

LoadFromRegistry() публичный Метод

public LoadFromRegistry ( ) : void
Результат void

LoadFromRegistry() публичный Метод

public LoadFromRegistry ( string keyName ) : void
keyName string
Результат void

MruStripMenu() защищенный Метод

protected MruStripMenu ( ) : System
Результат System

MruStripMenu() публичный Метод

Initializes a new instance of the MruMenu class.
public MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler ) : System
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
clickedHandler ClickedHandler
Результат System

MruStripMenu() публичный Метод

Initializes a new instance of the MruMenu class.
public MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, int maxEntries ) : System
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
clickedHandler ClickedHandler
maxEntries int
Результат System

MruStripMenu() публичный Метод

Initializes a new instance of the MruMenu class.
public MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName ) : System
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
clickedHandler ClickedHandler
registryKeyName string
Результат System

MruStripMenu() публичный Метод

Initializes a new instance of the MruMenu class.
public MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, bool loadFromRegistry ) : System
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
clickedHandler ClickedHandler
registryKeyName string
loadFromRegistry bool
Результат System

MruStripMenu() публичный Метод

Initializes a new instance of the MruMenu class.
public MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, bool loadFromRegistry, int maxEntries ) : System
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
clickedHandler ClickedHandler
registryKeyName string
loadFromRegistry bool
maxEntries int
Результат System

MruStripMenu() публичный Метод

Initializes a new instance of the MruMenu class.
public MruStripMenu ( ToolStripMenuItem recentFileMenuItem, ClickedHandler clickedHandler, string registryKeyName, int maxEntries ) : System
recentFileMenuItem System.Windows.Forms.ToolStripMenuItem
clickedHandler ClickedHandler
registryKeyName string
maxEntries int
Результат System

OnClick() защищенный Метод

protected OnClick ( object sender, System e ) : void
sender object
e System
Результат void

RemoveAll() публичный Метод

public RemoveAll ( ) : void
Результат void

RemoveFile() публичный Метод

public RemoveFile ( int number ) : void
number int
Результат void

RemoveFile() публичный Метод

public RemoveFile ( string filename ) : void
filename string
Результат void

RenameFile() публичный Метод

public RenameFile ( string oldFilename, string newFilename ) : void
oldFilename string
newFilename string
Результат void

RenameFile() публичный Метод

public RenameFile ( string oldFilename, string newFilename, string newEntryname ) : void
oldFilename string
newFilename string
newEntryname string
Результат void

SaveToRegistry() публичный Метод

public SaveToRegistry ( ) : void
Результат void

SaveToRegistry() публичный Метод

public SaveToRegistry ( string keyName ) : void
keyName string
Результат void

SetFiles() публичный Метод

public SetFiles ( string filenames ) : void
filenames string
Результат void

SetFirstFile() защищенный Метод

protected SetFirstFile ( MruMenuItem menuItem ) : void
menuItem MruMenuItem
Результат void

SetFirstFile() публичный Метод

public SetFirstFile ( int number ) : void
number int
Результат void

ShortenPathname() статический публичный Метод

Shortens a pathname for display purposes.
Shortens a pathname by either removing consecutive components of a path and/or by removing characters from the end of the filename and replacing then with three elipses (...)

In all cases, the root of the passed path will be preserved in it's entirety.

If a UNC path is used or the pathname and maxLength are particularly short, the resulting path may be longer than maxLength.

This method expects fully resolved pathnames to be passed to it. (Use Path.GetFullPath() to obtain this.)

static public ShortenPathname ( string pathname, int maxLength ) : string
pathname string
maxLength int
Результат string

Описание свойств

maxEntries защищенное свойство

protected int maxEntries
Результат int

maxShortenPathLength защищенное свойство

protected int maxShortenPathLength
Результат int

mruStripMutex защищенное свойство

protected Mutex,System.Threading mruStripMutex
Результат System.Threading.Mutex

numEntries защищенное свойство

protected int numEntries
Результат int

recentFileMenuItem защищенное свойство

protected ToolStripMenuItem,System.Windows.Forms recentFileMenuItem
Результат System.Windows.Forms.ToolStripMenuItem

registryKeyName защищенное свойство

protected string registryKeyName
Результат string