IAppointment implementation and drag & drop problem

3 posts, 1 answers
  1. Krzysztof
    Krzysztof avatar
    14 posts
    Member since:
    Oct 2007

    Posted 23 Aug 2012 Link to this post

    Dear Telerik Team!

    I have successfuly implemented drag and drop operation between ListBox and ScheduleView. I use custom appointment. Everything works fine when my custom appointment inherits from Appointment class. Unfortunately I need to use a class which inherits from EntityObject class so my custom appointment class must implement IAppointment interface instead of inheriting Appointment base class. After that drag and drop stopped working. Could you please provide me with some samples of correct IAppointment interface implementation. You can find a class I use for now down below:
    public class WMSAppointment : IAppointment
        {
            public string Body { get; set; }
            public ICategory Category { get; set; }
            public Importance Importance { get; set; }
            public DateTime End { get; set; }
            public DateTime Start { get; set; }
            public string Subject { get; set; }
            public IList Resources { get; set; }
            public int JobId { get; set; }
            public bool IsAllDayEvent { get; set; }
            public IRecurrenceRule RecurrenceRule { get; set; }
            public ITimeMarker TimeMarker { get; set; }
            public TimeZoneInfo TimeZone { get; set; }
     
            public event EventHandler RecurrenceRuleChanged;
            public event PropertyChangedEventHandler PropertyChanged;
     
            public bool Equals(IAppointment other)
            {
                var otherAppointment = other as WMSAppointment;
                return otherAppointment != null &&
                    other.Start == this.Start &&
                    other.End == this.End &&
                    other.Subject == this.Subject &&
                    this.JobId == otherAppointment.JobId &&
                    this.TimeMarker == otherAppointment.TimeMarker &&
                    this.TimeZone == otherAppointment.TimeZone &&
                    this.IsAllDayEvent == other.IsAllDayEvent &&
                    this.RecurrenceRule == other.RecurrenceRule;
            }
     
            public void BeginEdit()
            {
                throw new NotImplementedException();
            }
     
            public void CancelEdit()
            {
                throw new NotImplementedException();
            }
     
            public void EndEdit()
            {
                throw new NotImplementedException();
            }
     
            public IAppointment Copy()
            {
                IAppointment appointment = new WMSAppointment();
                appointment.CopyFrom(this);
     
                return appointment;
            }
     
            public void CopyFrom(IAppointment other)
            {
                this.IsAllDayEvent = other.IsAllDayEvent;
                this.Start = other.Start;
                this.End = other.End;
                this.Subject = other.Subject;
     
                var otherAppointment = other as WMSAppointment;
                if (otherAppointment == null)
                    return;
     
                this.JobId = otherAppointment.JobId;
                this.TimeMarker = otherAppointment.TimeMarker;
     
                this.Resources.Clear();
                this.Resources.AddRange(otherAppointment.Resources);
     
                this.Body = otherAppointment.Body;
            }
        }


    Thank you very much and best regards
    Krzysztof Kaźmierczak
  2. Answer
    Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 27 Aug 2012 Link to this post

    Hi Krzysztof,

    I am sending you attached your new ScheduleView example. It's real-world example, but it's still in test phase. Inside the project you'll see our implementation of SqlAppointment which inherits from EntityObject and also implements IAppointment.

    I hope this will bring you further.

    Greetings,
    Ventzi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Krzysztof
    Krzysztof avatar
    14 posts
    Member since:
    Oct 2007

    Posted 13 Nov 2012 Link to this post

    Thank you very much!

    Very best regards
    Krzysztof Kaźmierczak
Back to Top