2005-05-02, 02:33 PM 
	
	
	
		I am having trouble using the method getNamedColor.  I keeping getting an error Object reference not set to an instances of an object
This is what I have in my skin file.
And this is a snippet of code.
I have checked to make sure the skinHelper object is not null and I use it elsewhere in the same code block to read other settings so it seems to be okay. I also though perhaps I needed to allocate the color object before using it but that didnât change anything either. Any ideas?
Jeff
	
	
	
This is what I have in my skin file.
Quote:<!-- name colors -->
<NamedColors>
<!-- Colors must be solid colors, not gradients -->
<NamedColor name="FreeSpace" color="Yellow"/>
<NamedColor name="UsedSpace" color="Tomato"/>
<NamedColor name="EstimatedPendingSpace" color="SlateBlue"/>
</NamedColors>
And this is a snippet of code.
Code:
// Get a reference to the skin helper
XmlDocument document = new XmlDocument();
document.Load(SkinUtilities.FullActiveSkinPath + "archive\\Disk Space Dialog skin.xml");
skinHelper = new SkinHelper(document, SkinUtilities.FullActiveSkinPath + "archive");
// Setup colors
if (skinHelper == null)
    Logger.Error("-- skinHelper is null -- ");
try
{
    FreeSpaceColor = new Color();
    FreeSpaceColor = skinHelper.getNamedColor("FreeSpace");
}
catch (Exception e)
{
    Logger.Error ("Video Archiver - Error loading color FreeSpace from "+SkinUtilities.FullActiveSkinPath + "archive\\Disk Space Dialog skin.xml "+e.ToString());
    FreeSpaceColor = Color.Green;
}I have checked to make sure the skinHelper object is not null and I use it elsewhere in the same code block to read other settings so it seems to be okay. I also though perhaps I needed to allocate the color object before using it but that didnât change anything either. Any ideas?
Jeff
 

