Click here to Skip to main content
Click here to Skip to main content
Go to top

Most Recently Used (MRU) Component

, 5 Nov 2004
Rate this:
Please Sign up or sign in to vote.
A Most Recently Used component written in C#.

Sample Image - MRUHandler1.jpg

Introduction

In an effort to learn C#, I started to redevelop an application program that I had written in Java. I quickly realized, like many others, that there was no Most Recently Used functionality built into the .NET framework.

The MRUHandler component displays a most recently used (MRU) menu list. Multiple MRUHanlder components can be used in the same application without colliding. For example, the image above depicts the demo program supporting an MRU history for files and a MRU history for viewed URLs. As well, it will work within the context of a Multiple Document Interface (MDI) application.

Background

After searching CodeProject, I found two reference articles: Joe Woodury's Most Recently Used (MRU) Menu class in C# and Alex Farber's Add Most Recently Used Files (MRU) List to Windows Applications. Unfortunately, neither of these appealed to me, as I was looking for an approach that would allow me to "plug-in" the MRU functionality. After reading Philip Davis’ article Extended Interface for Status Message, I decided to try developing this functionality as a custom Component.

MRUHandler Overview

Properties

The properties can only be set from the Designer or during the framework initialization. I was unsuccessful in finding a way to serialize the properties from the designer into the runtime, as you were able to do in Visual Basic 6.0. What I ended up doing was implementing the ISupportInitialize interface. This interface allows the MRUHandler to trap the start and end of the initialization and set an initializing flag. If anyone knows how to get the framework to do this, I would sure appreciate the input.

public void BeginInit() {_isInitializing = true;}
public void EndInit() {
    _isInitializing = false;
    if (!DesignMode) {
        if (_mruItem == null) {
            throw new Exception("The property 'MruItem' item cannot be set to null");
        }
        RebuildMenu();
    }
}

Each of the properties then throws an exception if the _isInitializing flag is not set or the component is not in Design mode.

public MenuItem MruItem {
    get{ return _mruItem;  }
    set{ 
        if (!DesignMode && !_isInitializing) {
            throw new Exception("The 'MruItem' can be only set in Design Mode");
        }
        _mruItem = value; 
    }
}

Available Properties

  • DisplayLength: The maximum length of the MRU entry file name when displayed.
  • MaxFiles: The maximum number of files to be maintained in the MRU History.
  • MRUItem: The menu item that is the place holder for the history list (when the style is Inline) or the parent menu item (when the style is Popup).
  • MRUStyle: Enumerated type to indicate if the MRU history should be displayed inline or as a popup menu.
  • ShowShortItem: Boolean value to indicate whether the display name should be compressed. If this is false, then the DisplayLength property is ignored.
  • StorageName: Provides a name for the file or registry key that is used to persist the MRU history. If the StorageType property is File or IsolatedStorage, the complete file name is generated using the product name (Application.ProductName) and this property, and the extension of the file is .mru. If the StorageType is Registry, this property is used to create a subkey under the application user data registry (Application.UserAppDataRegistry).
  • StorageStyle: Enumerated property to determine the location of the persistent storage used to save the MRU history information. Values are:
    • IsolatedStorage: The MRU history is stored using the .NET Isolated Storage facilities.
    • File: The MRU history is stored on the file system in the executable path (Application.ExecutablePath).
    • Registry: The MRU history is stored using the Win32 Registry. The values are added to the key specified by the StorageName property.

Public Methods

  • AddRecentlyUsedFile:
    The maximum length of the MRU entry file name when displayed.

Events

  • MRUItemClicked: The maximum length of the MRU entry file name when displayed.

Using the MRUHandler Component

Once the MRUHandler is installed in Visual Studio, adding MRU support to your application is as simple as dragging the component on to the main window and choosing which menu item is to be used as the MRU history placeholder. It is a good idea to have named this menu item something meaningful in order to assist in finding it in the list.

Once you have chosen the menu item, then create the MRUItemClicked handler.

private void OnMRUItemClicked(object sender, 
        MostRecentlyUsedHandler.MRUItemClickedEventArgs e) {
    DoFileOpen(e.File);
}

The MRUItemClickedEventArgs has a property File that contains the path name of the file that corresponds to be opened from the MRU history. In the demo program, DoFileOpen reads the file and opens the child window to display the contents.

The last step is to provide the mechanism that allows the application to tell the MRUHandler which file paths to keep track of and display. This is done by calling the AddRecentlyUsedFile method and passing the file path name that was just opened.

private void DoFileOpen(string fileName) {
    FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
    Child form = new Child(fs);
    form.MdiParent = this;
    form.Show();
    mruHandler1.AddRecentlyUsedFile(fileName);
}

Points of Interest

Setting the modifier of the DataSet

When persisting the MRU to the file system, I had used a DataSet object to define an XML schema and do the actual transfer of information between the file system and the MRUHandler. I found that the default implementation provided by Visual Studio sets the access modifier of the generated class to public. The result was that MRUListFile would show up on the Toolbar as a component. It took a while, but I was able to change the access modifier of the generated class by going to the class view and selecting the properties of MRUListFile.xsd. I was then able to change the modifier to internal, which effectively hid this class in the designer.

Build Versioning

I found that each time I rebuilt the application that contains the MRUHandler, the MRU history would be reset to empty when I was using a StorageType with a value of Registry. It turns out that the Application.UserAppDataRegistry refers to an application subkey that contains the Visual Studio generated version number. If this is a problem, it would be quite simple to modify the code to remove the version number from the key.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Tim Almdal

Canada Canada
No Biography provided

Comments and Discussions

 
QuestionWork with ToolStripMenuItems? PinmemberCJMUK25-Nov-09 1:07 
Generallast file open Pinmembermr_view28-Mar-09 11:32 
QuestionCan I Get Just the Most Recently Used Files? Pinmemberjasmarc17-Mar-09 9:30 
GeneralFile not found - Storing to file Pinmemberpk_fox15-Feb-06 2:58 
GeneralRe: File not found - Storing to file [modified] Pinmembermad-matt30-Apr-09 9:32 
Questionupdate for .NET 2.0 menuStrip control? Pinmemberhungpvtn17-Jan-06 1:12 
AnswerRe: update for .NET 2.0 menuStrip control? [modified] PinmemberGeorge Birbilis23-Feb-07 2:30 

/*
* Last edit at 23Feb2007 by George Birbilis (birbilis@kagi.com)
*
* 23Feb2007:
* - Birb: changed to work with MenuStrip (.NET2.0) instead of MenuBar (.NET1.x)
* - Birb: renamed all MenuItem to ToolStripMenuItem
* - Birb: see various bug fixes below by searching for "Birb:"
* - Birb: added "AutoSeparators" property
*/
 
using System;
using System.ComponentModel;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.IO;
using System.IO.IsolatedStorage;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using Microsoft.Win32;
 
namespace MostRecentlyUsedHandler {
#region Enumerated Type Definitions
///
/// Enumerated type for the MRUStyle property
///
///
/// Popup
/// The Most Recently Used list is shown as a pop up menu.
///

///
/// Inline
/// The Most Recenly Used list is included in the menu where the desginated item would go.
///

///

///

public enum MRUStyle { Popup, Inline };
 
///
/// Enumerated type for the defining the persistent storage location of the Most Recently Used history
///
///
/// File
/// The Most Recently Used list persisted to the local file system.
///

///
/// Registry
/// The Most Recenly Used list is stored in the win32 registry.
///

///
/// IsolatedStorage
/// The Most Recenly Used list persisted in the .Net Isolated Storage.
///

///

///

public enum StorageStyle { File, Registry, IsolatedStorage };
#endregion
 
#region Most Recently Used menu click event definitions
///
/// The event arguments for the generated Most Recently Used menu click event
///

public class MRUItemClickedEventArgs : EventArgs {
private string _file;
public MRUItemClickedEventArgs(string file) { _file = file; }
 
public string File { get { return _file; } }
}
 
///
/// The delegate definition for the Most Recently Used menu click event
///

public delegate void MRUItemClickedHandler(object sender, MRUItemClickedEventArgs e);
#endregion
 
///
/// Summary description for MRUHandler.
///

[ToolboxBitmap(typeof(MRUHandler), "MRUHandler.bmp")]
public class MRUHandler : Component, ISupportInitialize {
 
#region private static definitions
///
/// Defines the Most Recently Used file definition
///

private static readonly string MRU_EXTENSION = ".mru";
///
/// Defines the registry key base name that is used to generate the key for each mru entry
///

private static readonly string REGISTRY_VALUE_NAME_BASE = "mru_entry_";
#endregion
 
public event MRUItemClickedHandler MRUItemClicked;
 
#region Constructors
public MRUHandler(System.ComponentModel.IContainer container) {
container.Add(this);
}
 
public MRUHandler() { }
#endregion
 
#region property field definitions
private ToolStripMenuItem _mruItem;
private MRUStyle _style;
private StorageStyle _storageStyle = StorageStyle.IsolatedStorage;
private int _maxFiles = 10;
private int _displayLength = 40;
private string _fileName = "mru";
private bool _showShortItem;
private bool _autoSeparators; //Birb (default value is "False" to maintain backwards compatibility)
#endregion
 
#region internal field definitions
private Hashtable _itemMap = new Hashtable();
private bool _mruIsDirty;
private ArrayList _mru;
private bool _isInitializing = false;
 
[DllImport("shlwapi.dll", CharSet = CharSet.Auto)]
private static extern bool PathCompactPathEx(StringBuilder pszOut, string pszPath, int cchMax, int reserved);
#endregion
 
///
/// Is the internal menu click handler for all of the Most Recently Used menu items. Based on the menuitem
/// the file name is retrieved from the Hashtable. The display text of the item will not be a usable file name.
/// For instance it has a number in front and the text could have been compressed by the 'ShowShortItem' property
///

/// Object that raised the event
/// Event information
protected void onMenuItemClick(Object sender, EventArgs e) {
ToolStripMenuItem item = (ToolStripMenuItem)sender;
if (MRUItemClicked != null) {
string fileName = (string)_itemMap[item];
MRUItemClicked(this, new MRUItemClickedEventArgs(fileName));
}
}
 
///
/// Add a file path name to the Most Recently Used history
///

/// path to be added
public void AddRecentlyUsedFile(string fileName) {
MRUList().Remove(fileName);
MRUList().Insert(0, fileName);
for (int i = _mru.Count; i > _maxFiles; ) {
_mru.RemoveAt(--i);
}
_mruIsDirty = true;
RebuildMenu();
}
 
#region properties
 
///
/// Property to determine the menuitem that becomes the place holder for the
/// Most Recently Used Menu items.
///

[Description("Specifies the menu item that is used as the MRU list parent.")]
public ToolStripMenuItem MruItem {
get { return _mruItem; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'MruItem' can be only set in Design Mode");
}
_mruItem = value;
}
}
 
///
/// Property that specifies what name is used in the storage of the MRU history
///

[Description("Specifies the name to be used to generate the file name for persistence.")]
public string StorageName {
get { return _fileName; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'StorageName' can be only set in Design Mode");
}
_fileName = value;
}
}
 
///
/// Property that determins the style of the MRU list at runtime
///

[Description("Specifies the style of the MRU list."),
DefaultValue(MRUStyle.Popup)]
public MRUStyle MRUStyle {
get { return _style; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'MRUStyle' can be only set in Design Mode");
}
_style = value;
}
}
 
///
/// Property to determine if the MRU menu item will show the truncated text.
///

[Description("Specifies whether the file name in the MRU entry should be truncated."),
DefaultValue(false)]
public bool ShowShortItem {
get { return _showShortItem; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'ShowShortItem' can be only set in Design Mode");
}
_showShortItem = value;
}
}
 
///
/// Property to determine if separators will be automatically placed arround inline MRU entries when necessery.
///

[Description("Specifies whether separators will be automatically placed arround inline MRU entries when necessery."),
DefaultValue(false)] //default value is "False" to maintain backwards compatibility
public bool AutoSeparators //Birb: added
{
get { return _autoSeparators; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'AutoSeparators' can be only set in Design Mode");
}
_autoSeparators = value;
}
}
 
///
/// Property to determine the type of persistent storage that should be used to store the MRU history.
///

[Description("Specifies the type of persistent storage to use to store the MRU history."),
DefaultValue(StorageStyle.IsolatedStorage)]
public StorageStyle StorageStyle {
get { return _storageStyle; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'StorageStyle' can be only set in Design Mode");
}
_storageStyle = value;
}
}
 
///
/// Property to determine the length of the MRU history.
///

[Description("Specifies the length of the MRU history file."),
DefaultValue(10)]
public int MaxFiles {
get { return _maxFiles; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'MaxFiles' can be only set in Design Mode");
}
_maxFiles = value;
if (_mru != null) //Birb: added this check to bypass null pointer exception case, described at http://www.codeproject.com/cs/menu/MRUHandler.asp?forumid=124432&select=1114259&df=100#xx1114259xx
{
_mru.Capacity = _maxFiles;
}
}
}
 
///
/// Property to determine the length of text to be shown if the ShowShortItem property is set to true.
///

[Description("Specifies the length of the MRU menu text when the ShowShortItem property is true."),
DefaultValue(40)]
public int DisplayLength {
get { return _displayLength; }
set {
if (!DesignMode && !_isInitializing) {
throw new Exception("The 'DisplayLength' can be only set in Design Mode");
}
_displayLength = value;
}
}
#endregion
 
#region Component overrides
///
/// Clean up any resources being used.
///

protected override void Dispose(bool disposing) {
if (_mruIsDirty) {
switch (_storageStyle) {
case StorageStyle.File:
saveToFile();
break;
case StorageStyle.Registry:
saveToRegistry();
break;
default:
saveToStorage();
break;
}
_mruIsDirty = false;
}
base.Dispose(disposing);
}
 
#endregion
 
#region Access MRU in a file in Isolated Storage
private ArrayList loadFromStorage() {
IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
// isoStore.DeleteFile(MRUFile());
if (isoStore.GetFileNames(MRUFile()).Length == 0) {
// File not exists. Create an empty file
return new ArrayList();
}
 
// Read the stream from Isolated Storage.
Stream stream = new IsolatedStorageFileStream(MRUFile(), FileMode.OpenOrCreate, isoStore);
if (stream != null) {
try {
// DeSerialize the Hashtable from stream.
IFormatter formatter = new BinaryFormatter();
ArrayList appData = (ArrayList)formatter.Deserialize(stream);
return appData;
}
finally {
// We are done with it.
stream.Close();
}
}
else {
return new ArrayList();
}
}
private void saveToStorage() {
// Open the stream from the IsolatedStorage.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
Stream stream = new IsolatedStorageFileStream(MRUFile(), FileMode.Create, isoStore);
 
if (stream != null) {
try {
// Serialize the Hashtable into the IsolatedStorage.
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, MRUList());
}
finally {
stream.Close();
}
}
}
#endregion
 
#region Access MRU in a file on the file system
private ArrayList loadFromFile() {
_mruIsDirty = false;
MRUListFile mruLF = new MRUListFile();
FileInfo fi = new FileInfo(Application.ExecutablePath);
 
mruLF.ReadXml(fi.DirectoryName + '\\' + MRUFile(), System.Data.XmlReadMode.IgnoreSchema);
ArrayList mru = new ArrayList(mruLF.MRUList.Rows.Count);
 
foreach (MRUListFile.MRUListRow row in mruLF.MRUList.Rows) {
mru.Add(row.mruentry);
}
 
return mru;
}
 
private void saveToFile() {
MRUListFile mruLF = new MRUListFile();
foreach (String str in MRUList()) {
mruLF.MRUList.AddMRUListRow(str);
}
FileInfo fi = new FileInfo(Application.ExecutablePath);
 
/*---------------*/
//Birb: changed to address the issue mentioned at http://www.codeproject.com/cs/menu/MRUHandler.asp?forumid=124432&select=1371902&df=100#xx1371902xx
String filename = (fi.DirectoryName + '\\' + MRUFile());
if (!System.IO.File.Exists(filename)) { System.IO.File.Create(filename); }
mruLF.WriteXml(filename, XmlWriteMode.IgnoreSchema);
/*---------------*/
}
#endregion
 
#region Access MRU stored in the registry
private ArrayList loadFromRegistry() {
RegistryKey key = Application.UserAppDataRegistry;
RegistryKey mruKey = key.OpenSubKey(_fileName, true);
if (mruKey != null) { // does it exist, if so load the values
object mruCount = mruKey.GetValue("mru_count");
int mruSize = (int)mruCount;
ArrayList mru = new ArrayList(mruSize);
for (int i = 0; i < mruSize; i++) {
StringBuilder sb = new StringBuilder(REGISTRY_VALUE_NAME_BASE.Length + 10);
sb.Append(REGISTRY_VALUE_NAME_BASE).Append(i);
mru.Add(mruKey.GetValue(sb.ToString()));
}
 
return mru;
}
else {
return new ArrayList();
}
}
 
private void saveToRegistry() {
/*-------------*/
//Birb: changed as advised at http://www.codeproject.com/cs/menu/MRUHandler.asp?forumid=124432&select=975936&df=100#xx975936xx
RegistryKey key = Application.UserAppDataRegistry;
 
// no child keys anyway but also say don't throw
key.DeleteSubKey(_fileName, false); // so we can replace all the duplicates
 
RegistryKey mruKey = key.CreateSubKey(_fileName);
/*-------------*/
 
int counter = 0;
mruKey.SetValue("mru_count", MRUList().Count);
foreach (String str in MRUList()) {
StringBuilder sb = new StringBuilder(REGISTRY_VALUE_NAME_BASE.Length + 10);
sb.Append(REGISTRY_VALUE_NAME_BASE).Append(counter++);
mruKey.SetValue(sb.ToString(), str);
}
}
#endregion
 
#region menu item builder functions
///
/// Rebuilds the Most Rcently Used menu base on the value of the MRUStyle property
///

private void RebuildMenu() {
if (_style == MRUStyle.Popup) {
RebuildPopupMenu(); //Birb: moved code to "RebuildPopupMenu"
}
else {
RebuildInlineMenu();
}
}
 
///
/// Rebuild the popup version of the most recently used list
///

private void RebuildPopupMenu() //Birb: added for better code readability (since original code already had a separate "RebuildInlineMenu")
{
_mruItem.DropDownItems.Clear(); //Birb: renamed MenuItems to DropDownItems
_itemMap.Clear();
_mruItem.Enabled = MRUList().Count > 0;
int counter = 1;
foreach (string str in MRUList()) {
ToolStripMenuItem item = buildMenuItem(counter++, str);
_itemMap.Add(item, str);
_mruItem.DropDownItems.Add(item); //Birb: renamed MenuItems to DropDownItems
}
}
 
///
/// Rebuild the inline version of the most recently used list
///

private void RebuildInlineMenu() {
foreach (ToolStripMenuItem item in _itemMap.Keys) { // dispose all the existing menu items
item.Dispose();
}
 
_itemMap.Clear(); // Now that the menuitems are disposed, clear the table
 
if (MRUList().Count > 0) { // if no mru list then leave the place holder visible
_mruItem.Visible = false; // force the place holder item to inert
}
_mruItem.Enabled = false;
 
int offset = 1;
ToolStripMenuItem parentMenu = (ToolStripMenuItem)_mruItem.OwnerItem;// get our parent //Birb: renamed Parent to OwnerItem
ToolStripItemCollection parentItems = parentMenu.DropDownItems; //Birb: used instead of parentMenu.MenuItems
int MRUMenuIndex = /*_mruItem.Index*/ parentItems.IndexOf(_mruItem); // where are we in the chain //Birb: changed the code to find the _mruItem index inside its parent since there's no Index property at ToolStripItem
 
if (_autoSeparators && (MRUList().Count > 0)) { //Birb
 
//Birb: "prepend" separator to mru item if not first item and not existing already
if ((MRUMenuIndex != 0) && !(parentItems[MRUMenuIndex - 1] is ToolStripSeparator)) {
parentMenu.DropDownItems.Insert(MRUMenuIndex, new ToolStripSeparator());
MRUMenuIndex += 1; //update the mru item index since we prepended a separator
}
 
//Birb: "append" separator to mru item if not last item and not existing already
if ((MRUMenuIndex != parentItems.Count - 1) && !(parentItems[MRUMenuIndex + 1] is ToolStripSeparator)) {
parentMenu.DropDownItems.Insert(MRUMenuIndex + 1, new ToolStripSeparator());
//don't update the mru item index, we appended something (didn't prepend anything)
}
 
}
 
foreach (string str in MRUList()) {
ToolStripMenuItem item = buildMenuItem(offset, str);
_itemMap.Add(item, str);
parentItems.Insert(MRUMenuIndex + offset, item); //Birb: renamed parentMenu.MenuItems to parentItems, renamed Add to Insert
offset++;
}
}
 
///
/// Builds a menu item for the path entry
///

/// Position in list
/// path
///
private ToolStripMenuItem buildMenuItem(int position, string text) {
StringBuilder sb = new StringBuilder(text.Length + 10);
if (position < 10) { // only put ampersands on the first 9, otherwise
sb.Append('&'); // we can't tell the difference between 1 & 10
}
sb.Append(position).Append(' ');
sb.Append(!_showShortItem ? text : GetShortDisplayName(text, _displayLength));
 
ToolStripMenuItem item = new ToolStripMenuItem(sb.ToString());
 
if (_style == MRUStyle.Inline) {
item.MergeIndex = _mruItem.MergeIndex; //Birb: renamed MergeOrder to MergeIndex
item.MergeAction = _mruItem.MergeAction; //Birb: renamed MergeType to MergeAction
}
 
item.Click += new System.EventHandler(onMenuItemClick);
 
return item;
}
 
///
/// Truncate a path to fit within a certain number of characters
/// by replacing path components with ellipses.
///
/// This solution is provided by CodeProject and GotDotNet C# expert
/// Richard Deeming.
///
///

/// Long file name
/// Maximum length
/// Truncated file name
private string GetShortDisplayName(string longName, int maxLen) {
StringBuilder pszOut = new StringBuilder(maxLen + maxLen + 2); // for safety
if (PathCompactPathEx(pszOut, longName, maxLen, 0)) {
return pszOut.ToString();
}
else {
return longName;
}
}
 
#endregion
 
#region internal helper functions
///
/// Generates a standard file name to be used to persist the mru history.
/// The formation is product name_file name property.mru
///

/// A string representing the file name to be used to store the mru history/returns>
private string MRUFile() {
StringBuilder sb = new StringBuilder(256);
sb.Append(Application.ProductName).Append('_').Append(_fileName).Append(MRU_EXTENSION);
return sb.ToString();
}
 
///
/// Loads the mru history from the defined storage location.
///

/// An array containing the MRU history
private ArrayList MRUList() {
if (_mru == null) {
switch (_storageStyle) {
case StorageStyle.File:
_mru = loadFromFile();
break;
case StorageStyle.Registry:
_mru = loadFromRegistry();
break;
default:
_mru = loadFromStorage();
break;
}
_mruIsDirty = false;
for (int i = _mru.Count; i > _maxFiles; ) {
_mru.RemoveAt(--i);
}
}
 
return _mru;
}
#endregion
 
#region ISupportInitialize Implementation
///
/// Implementation of the BeginInit Method. Set a flag so that we are initializing the
/// component by the framework. This will bypass all the run time error check on setting
/// the parameters.
///

public void BeginInit() { _isInitializing = true; }
 
///
/// Implementation of the EndInit Method. When we this method is called, the framework
/// has completed initializing the component with the values that were set in the designer.
/// We now set the flag so that run time parameter setting is basically disabled.
///

public void EndInit() {
_isInitializing = false;
if (!DesignMode) {
if (_mruItem == null) {
throw new Exception("The property 'MruItem' item cannot be set to null");
}
RebuildMenu();
}
}
#endregion
}
}

 

-- modified at 10:11 Friday 23rd February, 2007
 
Microsoft MVP J# 2004-2007
Borland "Spirit of Delphi"
QuickTime, ActiveX, VCL, .NET, Robotics
http://www.kagi.com/birbilis
http://birbilis.spaces.live.com

GeneralBug with MRU File storage Pinmemberattrixx22-May-05 23:41 
GeneralFile not found PinmemberTJO119-Nov-04 16:23 
GeneralRe: File not found Pinmembertalmdal19-Nov-04 17:27 
GeneralRe: File not found Pinmembercodegalaxy11-Mar-05 9:14 
Generalcode change in saveToRegistry() Pinmemberhans_nl11-Nov-04 23:52 
GeneralRe: code change in saveToRegistry() Pinmembertalmdal12-Nov-04 19:01 
GeneralRe: code change in saveToRegistry() Pinmembermchumph18-Nov-04 1:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 5 Nov 2004
Article Copyright 2004 by Tim Almdal
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid