Take the TelevisionProgramme class and add Ant content entry .NET attributes to mark it for content entry
- (page 3 of 6)
Add the following using statements to the top of the file.
using Ant.ContentEntry; //needed for core content entry services
using Ant.ContentEntry.Converters; // needed for standard converters
using Ant.ContentEntry.FieldDisplayers; // needed for standard displayers
using Ant.ContentEntry.ClassInformation; // needed for the attributes
Now at the top of the class add a ClassOverview attribute. It looks like this:
/// <summary>class representing a television programme</summary>
[ClassOverview]
public class TelevisionProgramme
{
For the ProgrammeName property, add the following attributes.
/// <summary>Gets and sets the name of the television programme</summary>
[PropertyInformation(typeof(StringConverter), typeof(InputEntry), true, 0)]
[PropertyLanguage(PropertyLanguage.English, "Programme name",
"This is the name of the television programme", "You must specify a programme name")]
public string ProgrammeName
The attributes specify that this property is:
  | | A string, as signified by the StringConverter in property information. |
  | | It uses default entry as specified by InputEntry. |
  | | It is required, as specified by the true. |
  | | It is the first field, as specified by the 0. |
They also specify the English language version used in the form.
Mark up the other properties as follows:
using System;
using Ant.ContentEntry; //needed for core content entry services
using Ant.ContentEntry.Converters; // needed for standard converters
using Ant.ContentEntry.FieldDisplayers; // needed for standard displayers
using Ant.ContentEntry.ClassInformation; // needed for the attributes
namespace HowTos
{
/// <summary>class representing a television programme</summary>
[ClassOverview]
public class TelevisionProgramme
{
string programmeName;
int channel;
DateTime start=DateTime.Now;
int duration=30;
/// <summary>Default constructor required by content entry</summary>
public TelevisionProgramme()
{
}
/// <summary>Gets and sets the name of the television programme</summary>
[PropertyInformation(typeof(StringConverter), typeof(InputEntry), true, 0)]
[PropertyLanguage(PropertyLanguage.English, "Programme name", "This is the name of the television programme", "You must specify a programme name")]
public string ProgrammeName
{
get
{
return programmeName;
}
set
{
programmeName = value;
}
}
/// <summary>Gets and sets the channel that the programme is on</summary>
[PropertyInformation(typeof(Int32Converter), typeof(InputEntry), true, 1)]
[PropertyLanguage(PropertyLanguage.English, "Channel number", "Number of the channel that this program is on", "You must specify a channel number")]
public int Channel
{
get
{
return channel;
}
set
{
channel = value;
}
}
/// <summary>Start time of the programme</summary>
[PropertyInformation(typeof(DateTimeConverter), typeof(InputEntry), true, 2)]
[PropertyLanguage(PropertyLanguage.English, "Date of programme", "Date the program is on", "You must specify a date ")]
public DateTime Start
{
get
{
return start;
}
set
{
start = value;
}
}
/// <summary>Duration of the programme</summary>
[PropertyInformation(typeof(Int32Converter), typeof(InputEntry), true, 3)]
[PropertyLanguage(PropertyLanguage.English, "Duration", "Duration of the programme", "You must specify the duration of the programme")]
public int Duration
{
get
{
return duration;
}
set
{
duration = value;
}
}
}
}
Note the addition of default values for the private variables.