public override void CopyFrom(IAppointment other) { ProgrammeAppointment appointment = other as ProgrammeAppointment; if (appointment != null) { this.Duration = appointment.Duration; if (appointment.Resources.Any()) { var resourcesCollection = (ResourceCollection)appointment.Resources; this.Programme = resourcesCollection.First(r => r.ResourceType == "TV").DisplayName; this.ProgrammeLabel = resourcesCollection.Count > 1 ? resourcesCollection.First(r => r.ResourceType == "Programme").DisplayName.ToUpperInvariant() : "NEWS"; if (resourcesCollection.Count == 1) { appointment.Resources.Add(new Resource() { ResourceType = "Programme", ResourceName = "News" }); } } this.LabelBrush = this.GetProgrammeBrush(this.ProgrammeLabel); this.ProgrammeImageSource = appointment.ProgrammeImageSource; this.IsLive = appointment.IsLive; } base.CopyFrom(other); }
public override IAppointment Copy() { IAppointment appointment = new ProgrammeAppointment(); appointment.CopyFrom(this); return(appointment); }