using System;
using System.Collections;
using Ironring.MMC.Nodes;
using Ironring.MMC.Core;
namespace MMCTest2{
/// <summary>
/// Trying to create a node that can change it's own behaviour (change node type)
/// through actions
/// </summary>
public class PolyNode : BaseNode
{
protected bool html;
protected string m_url;
public string Url
{
get{return "www.google.com";}
//set{m_url = value;}
}
public PolyNode(SnapinBase snapin, string displayName, string imageClosed, string imageOpen)
: base(snapin, displayName, imageClosed, imageOpen)
{
}
public override System.Collections.ArrayList Menus
{
get
{
ArrayList menus = new ArrayList();
menus.Add(new MenuItem("Change To HTML", "", new MenuCommandHandler(HtmlChangeHandler)));
menus.Add(new MenuItem("Change To Result", "", new MenuCommandHandler(ResultChangeHandler)));
return menus;
}
}
private void HtmlChangeHandler(object o, BaseNode node)
{
if(!html)
html = true;
Snapin.SelectScopeNode(this);
}
private void ResultChangeHandler(object o, BaseNode node)
{
if(html)
html = false;
Snapin.SelectScopeNode(this);
}
public override string GetResultViewType(ref int pViewOptions)
{
string retval;
// the default for std list views
//pViewOptions = 0;
if(html)
retval = Url;
else
retval = base.GetResultViewType(ref pViewOptions);
return retval;
}
public override string ResultViewSmallImage
{
get
{
return "MMCTest2.images.snapin.Ico";
}
}
public override string ResultViewLargeImage
{
get
{
return "MMCTest2.images.snapin.Ico";
}
}
}
}
|