... populating columns with text and image
//...
private void addSecurityRow(PortalTreeNode ptn, XmlNode objPermissions) {
//Check if we have an object in yet
int intIndex = securityObjectIndex(ptn.SearchPath);
if (intIndex == -1) {
object[] nRow;
if (objPermissions == null) {
nRow = new object[] {
getSecurityObjectIcon(ptn.Type),
ptn.DefaultName,
ptn.Type.ToString(),
Helper.getPermissionIcon(null),
Helper.getPermissionIcon(null),
Helper.getPermissionIcon(null),
Helper.getPermissionIcon(null),
Helper.getPermissionIcon(null),
ptn.SearchPath };
} else {
nRow = new object[] {
getSecurityObjectIcon(ptn.Type),
ptn.DefaultName,
ptn.Type.ToString(),
Helper.getPermissionIcon(objPermissions.SelectSingleNode(\"item[name='read']\")),
Helper.getPermissionIcon(objPermissions.SelectSingleNode(\"item[name='write']\")),
Helper.getPermissionIcon(objPermissions.SelectSingleNode(\"item[name='execute']\")),
Helper.getPermissionIcon(objPermissions.SelectSingleNode(\"item[name='setPolicy']\")),
Helper.getPermissionIcon(objPermissions.SelectSingleNode(\"item[name='traverse']\")),
ptn.SearchPath };
}
Node node = new Node(nRow);
this.lvSecurity.Rows.Items.Add(node);
} else {
}
}
//...
and the Helper class
//...
class Helper {
public static Image getPermissionIcon(XmlNode objPermission) {
//Assembly assem = GetType().Assembly;
Image img;
if (objPermission == null)
//stream = assem.GetManifestResourceStream(\"Security.Resources.access_none.gif\");
img = (Image)Security.Properties.Resources.ResourceManager.GetObject(\"access_none\");
else
//stream = assem.GetManifestResourceStream(
img = (Image)Security.Properties.Resources.ResourceManager.GetObject(\"access_\"
+ objPermission.SelectSingleNode(\"name\").InnerText.Replace(\"setPolicy\", \"set_policy\")
+ \"_\"
+ objPermission.SelectSingleNode(\"access\").InnerText
+ \"\");
//Image img = Image.FromStream(stream);
img.Tag = objPermission;
return img;
}
}
//...