|
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace JFileManager
{
/// <summary>
/// Class based on ToolStripMenuItem with additional information
/// </summary>
public class cTSMenuItem : ToolStripMenuItem
{
public string Path = "";
public string SortName = "";
public ObjectType ObjectType = ObjectType.NONE;
public cTSMenuItem(ObjectType oType, EventHandler eh)
{
if (oType == ObjectType.COMPUTER)
{
this.GetComputerInformation(eh);
}
}
public cTSMenuItem(cJDriveInfo jDriveInfo, EventHandler eh)
{
this.ObjectType = jDriveInfo.ObjectType;
this.Text = jDriveInfo.DisplayName;
this.Path = jDriveInfo.Path;
this.SortName = this.Path;
this.Image = jDriveInfo.Image;
this.Click += new EventHandler(eh);
}
public cTSMenuItem(DirectoryInfo dInfo, EventHandler eh)
{
this.ObjectType = ObjectType.FOLDER;
this.Text = dInfo.FullName;
this.Path = dInfo.FullName;
this.SortName = this.Path;
this.Image = cCommon.ImageFromPath(dInfo.FullName);
this.Click += new EventHandler(eh);
}
private void GetComputerInformation(EventHandler eh)
{
cJComputerInfo computerInfo = new cJComputerInfo();
this.ObjectType = ObjectType.COMPUTER;
this.Text = computerInfo.DisplayName;
this.Path = computerInfo.Path;
this.SortName = "_" + this.Path;
this.Image = computerInfo.Image;
this.Click += new EventHandler(eh);
}
}
}
|
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.
I have been a keen hobbyist programmer since getting my first computer - a Vic 20 (you had to be able to write programs then since few programs were available and all were expensive).
Retired and now living in Pewsey, Wiltshire, where I spend (far too much of) my time writing computer programs to keep my mind active.