Add the following class to you project.
using System;
using System.Xml;
using System.Windows.Forms;
using Ant.ContentEntry;
using Ant.ContentEntry.Windows;
using Ant.Licensing;
namespace HowTos
{
/// <summary>
/// Class which is run to start the application, edit the class and trace the results
/// </summary>
public class MainClass
{
static public int Main(string[] args)
{
// Gets the content definition for our class, using default (null) user
ContentDefinition def = new ContentDefinitionFactory(null, "ENGLISH", 0).ForClass(typeof(TelevisionProgramme));
// Construct a version of our class to edit
TelevisionProgramme programme = new TelevisionProgramme();
// Construct a form off this object
ContentEntryWindowsForm form = new ContentEntryWindowsForm("Test", def, XmlHelper.GetInstanceFromObject(def, programme));
// Show the form and check the OK button was checked
if (form.ShowDialog() == DialogResult.OK)
{
// Map the values back in to the object
programme = XmlHelper.GetObjectFromInstance(def, form.InstanceData) as TelevisionProgramme;
//Trace out the results
System.Diagnostics.Trace.WriteLine("Programme name:"+programme.ProgrammeName);
System.Diagnostics.Trace.WriteLine("Channel:"+programme.Channel.ToString());
System.Diagnostics.Trace.WriteLine("Date:"+programme.Start.ToString("dd-MM-yyyy HH:mm"));
System.Diagnostics.Trace.WriteLine("Duration:"+programme.Duration.ToString());
}
return 0;
}
}
}
Running this code allows you to edit the class in an automatically generated form. The information you enter in to the form is then mapped back to the object and traced.