using System;
using System.Collections;
using Ironring.MMC.Core;
using Ironring.MMC.Nodes;
using Ironring.MMC.Wizards;
using Ironring.MMC.PropertyPages;
namespace MMCTest2{
/// <summary>
/// Summary description for MyReportNode.
/// </summary>
public class MyReportNode : ReportNode
{
public static ResultViewColumn col1 = new ResultViewColumn("Pet Name", (int)ColumnHeaderFormat.LEFT, 100);
public static ResultViewColumn col2 = new ResultViewColumn("Pet Age", (int)ColumnHeaderFormat.CENTER, 50);
public static ResultViewColumn col3 = new ResultViewColumn("Kind of Pet", (int)ColumnHeaderFormat.CENTER, 100);
public MyReportNode(SnapinBase snapin, String displayName, String closedIco, String openIco) : base(snapin, displayName, closedIco, openIco)
{
this.MultiSelectMode = true; // Alex
Items = new ArrayList();
Items.Add(new MyResultViewItem("Poekie", "8", "Cat",
this.Snapin, this, "MMCTest2.images.Happy.ico", "MMCTest2.images.Happy.ico"));
Items.Add(new MyResultViewItem("Kimmy", "12", "Cat",
this.Snapin, this, "MMCTest2.images.Happy.ico", "MMCTest2.images.Happy.ico"));
for(int i=0;i<1000;i++)
{
Items.Add(new MyResultViewItem("Kimmy-" + i , "12", "Cat",
this.Snapin, this, "MMCTest2.images.Happy.ico", "MMCTest2.images.Happy.ico"));
}
}
public override int GetViewType()
{
return (int)ViewMode.Filtered;
}
public override ArrayList Columns
{
get
{
ArrayList cols = new ArrayList();
cols.Add(col1);
cols.Add(col2);
cols.Add(col3);
return cols;
}
}
public override string ResultViewSmallImage
{
get
{
return "MMCTest2.images.snapin.Ico";
}
}
public override string ResultViewLargeImage
{
get
{
return "MMCTest2.images.snapin.Ico";
}
}
// public override ArrayList Items
// {
// get
// {
// return m_items;
// }
// }
public override ArrayList Menus
{
get
{
ArrayList menus = new ArrayList();
menus.Add(new MenuItem("Refresh", "Refresh this list", new MenuCommandHandler(RefreshHandler)));
menus.Add(new MenuItem("Add Item", "Add an Item to the list", new MenuCommandHandler(AddItemHandler)));
return menus;
}
}
private void RefreshHandler(object o, BaseNode a)
{
this.RefreshResultConsole();
}
private void AddItemHandler(object o, BaseNode a)
{
WizardBase.ShowNonThreadedWizard("Add an Item to the List",
new WizardPage[] { new WzdAddItem() },
new WizardBase.WizardAction(WizardHandler));
}
private void WizardHandler(WizardPage[] pages)
{
String name = ((WzdAddItem)pages[0]).tbName.Text;
String type = ((WzdAddItem)pages[0]).tbKind.Text;
String age = ((WzdAddItem)pages[0]).spinnerAge.Value.ToString();
Items.Add(new MyResultViewItem(name, age, type, this.Snapin, this,
"MMCTest2.images.Happy.ico","MMCTest2.images.Happy.ico"));
this.RefreshResultConsole();
}
public override ArrayList PropertyPages
{
get
{
ArrayList pages = new ArrayList();
pages.Add(new PropertyPage("PropertyPage", typeof(MyPropertyPage), this));
return pages;
}
}
}
}
|