|
/*
Copyright (c) 2004, Marc Clifton
All rights reserved.
Usage restricted under the terms of the BSD License conditions:
http://opensource.org/licenses/bsd-license.php
*/
using System;
using System.Drawing;
using System.Diagnostics;
using System.Reflection;
using System.Windows.Forms;
using System.Xml;
namespace XmlGuiGenerator
{
/// <summary>
/// Manage the MainMenu data type.
/// </summary>
public class MainMenuModel : PropertyModelBase
{
/// <summary>
/// Add a menu item to the form's Menu property and parse the child nodes.
/// </summary>
/// <param name="obj">The Form instance with a Menu property.</param>
/// <param name="pi">The PropertyInfo instance.</param>
/// <param name="val">not used.</param>
/// <param name="target">Passed to the sub-form creation process.</param>
/// <returns>null</returns>
public override object SetValue(object obj, PropertyInfo pi, string val, object target)
{
MainMenu menu=new MainMenu();
try
{
generator.ProcessAttributes(menu, currentNode.Attributes, target);
generator.ProcessCollections(menu, currentNode, target);
((Form)obj).Menu=menu;
}
catch(Exception e)
{
Trace.WriteLine("MainMenu: Setter failed for: "+pi.ToString()+" val="+val+" "+e.Message);
}
return null;
}
}
}
|
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.