|
public class SimpleScheduleDataProvider : ArrayListDataProvider
{
/// <summary>
/// Default constructor.
/// </summary>
public SimpleScheduleDataProvider()
: base()
{
}
public override IScheduleAppointment NewScheduleAppointment()
{
return new SimpleScheduleAppointment();
}
}
public class SimpleScheduleAppointment : ArrayListAppointment, ISerializable
{
/// <summary>
/// Default constructor.
/// </summary>
public SimpleScheduleAppointment() : base()
{
}
public bool AssignedTo { get; set; }
} |
|
Form2 form = new Form2();
this
.scheduleControl1.ShowingAppointmentForm += scheduleControl1_ShowingAppointmentForm; void scheduleControl1_ShowingAppointmentForm(object sender, ShowingAppointmentEventArgs e)
{
//To get the current item.
form.Item = e.Item as SimpleScheduleAppointment;
//Cancel the default appointment form for schedule control.
e.Cancel = true;
//Shows the Custom appointment form.
form.ShowDialog();
}
|
|
void ok_Click(object sender, System.EventArgs e)
{
//Existing item
if (this.Item.UniqueID > -1)
{
this.DeleteRecurringAppointment(Item as IRecurringScheduleAppointment);
this.populateItem(this.Item);
}
else
{
SimpleScheduleAppointment item = DataProvider.NewScheduleAppointment() as SimpleScheduleAppointment;
this.populateItem(item);
}
this.schedulegrid.ResetProvider(this.schedulegrid.ScheduleType);
this.Close();
}
private void populateItem(SimpleScheduleAppointment item)
{
if(item != null)
{
item.StartTime = this.StartDateDateTimePickerAdv.Value;
item.EndTime = this.EndDateDateTimePickerAdv.Value;
item.Subject = this.SubjectTextBoxExt.Text;
item.LabelValue = this.comboBox1.SelectedIndex;
item.AssignedTo = this.assignedTo.Checked;
//Appointment can be added in ScheduleDataProvider
DataProvider.AddItem(item);
}
} |