Import events from Facebook: Create the Facebook event helper class
To present a Facebook event, you must create a wrapper.
To create the Facebook event wrapper class, perform the following procedure:
-
In the context menu of folder Utilities, click Add » Class...
-
In the Name input field, enter FacebookEvent.
-
Open the file FacebookEvent.cs and add the following constructors:
public FacebookEvent()
{
this.Id = String.Empty;
this.Name = String.Empty;
this.Location = String.Empty;
this.StartTime = DateTime.Now;
this.EndTime = DateTime.Now;
}
public FacebookEvent( string id, string name, string location, DateTime startTime, DateTime endTime )
: this()
{
this.Id = id;
this.Name = name;
this.Location = location;
this.StartTime = startTime;
this.EndTime = endTime;
}
-
Define the Facebook event properties by pasting the following code:
public string Id
{
get;
set;
}
public string Name
{
get;
set;
}
public string Location
{
get;
set;
}
public DateTime StartTime
{
get;
set;
}
public DateTime EndTime
{
get;
set;
}
You create the FacebookEvent class to present a Facebook event. Then, you define the Id, Name, Location, StartTime andEndTime properties that Facebook provides you when requesting the event.