Some appointments not shown on first load

8 posts, 1 answers
  1. Shantimohan
    Shantimohan avatar
    42 posts
    Member since:
    Jul 2012

    Posted 21 Jun 2012 Link to this post

    I am building a sample WP7 app to do things the way I will be implementing. In this I have appointments created by my own app and also get the appointments from the phone. So I was using the 'ContactsAndCalendar' example from MSDN. I added a new PivotItem to it in which I added code modeled on that in your 'AppointmentViewer' project in the downloaded samples.

    I do create sample data into the ObservableCollection Appts. I also populate another ObservableCollection PhoneAppts with that from the phone through AppointmentSearch API.

    My FetchData() code is as below:
    public override void FetchData(DateTime startDate, DateTime endDate)
    {
        this.AllAppointments.Clear();
     
        foreach (EventViewModel appt in MainPage.mainViewModel.Appts)
        {
            this.AllAppointments.Add(new MyAppointment()
            {
                Subject = appt.EventDesc,
                StartDate = appt.DateBegin,
                EndDate = appt.DateEnd,
                EventID = appt.EventID,
                TimeDuration = appt.DateEnd - appt.DateBegin,
                CurrentStatus = appt.CurrentStatus,
                Importance = appt.Importance,
                EventLocation = appt.EventLocation,
                EventSource = appt.EventSource,
                EventNotes = appt.EventNotes
            });
        }
     
        foreach (EventViewModel pappt in MainPage.mainViewModel.PhoneAppts)
        {
            this.AllAppointments.Add(new MyAppointment()
            {
                Subject = pappt.EventDesc,
                StartDate = pappt.DateBegin,
                EndDate = pappt.DateEnd,
                EventID = pappt.EventID,
                TimeDuration = pappt.DateEnd - pappt.DateBegin,
                CurrentStatus = pappt.CurrentStatus,
                Importance = pappt.Importance,
                EventLocation = pappt.EventLocation,
                EventSource = pappt.EventSource,
                EventNotes = pappt.EventNotes
            });
        }
     
        this.OnDataLoaded();
    }

    Upon first loading the page, I see the 3 days of appointments (as shown by the filled date boxes) from the Appts only in the Calendar. I am not talking about the DataBoundLIstBox below it. I see empty date boxes for all other dates, where I do have PhoneAppts. I have two issues here:

    1. When I click an empty date box, I do get those appointments listed in the DataBoundListBox. But the date boxes in the Calendar are still empty.
    2. When I swipe up or down to other months, the date boxes get filled up.

    How can I get those date boxes filled up on first loading with entries from PhoneAppt also?

    ThanQ...
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 22 Jun 2012 Link to this post

    Hi Shantimohan,

    Thank you for your interest in RadCalendar.

    If you are following the pattern of the example, you should see the appointments in the Calendar itself as well. The FetchData method should be called when the MainPage is loaded. If you have done so, I'd like to ask you to prepare a sample project and send it to us, so that we can see what is preventing the appointments from showing.

    Kind regards,
    Todor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Shantimohan
    Shantimohan avatar
    42 posts
    Member since:
    Jul 2012

    Posted 24 Jun 2012 Link to this post

    I was not using OnLoad event earlier. But now even using it as mentioned by you didn't help. Here is the sample project that I was trying.

  5. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 28 Jun 2012 Link to this post

    Hello,

    We tested your code and it looks good and actually works as expected on our end.

    What you can check is if on the first load you have the phone appointments added in the PhoneEvents collection. Did you check if this method - PhoneAppointments_SearchCompleted - is executed before adding the appointments in the Calendar?

    Please check these two things and let us know if you need more help!

    All the best, Valentin.Stoychev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Shantimohan
    Shantimohan avatar
    42 posts
    Member since:
    Jul 2012

    Posted 03 Jul 2012 Link to this post

    While debugging as suggested by you, I realized that the FetchData() method is called by the constructor also. So initializing the eventSource in the PhoneAppointments_SearchCompleted event handler at the end after getting the appointments from phone's calendar and adding them to the AllAppointments list has resolved my issue.

    It's a great control.

    ThanQ...
  7. Wolfshund
    Wolfshund avatar
    50 posts
    Member since:
    Feb 2007

    Posted 04 Jul 2012 Link to this post

    I'm also trying to bind the phone's calender (appointment) data to the Radcalendar, but without any success yet. Is there a simple sample available and also are there any restrictions in accessing the phone's calendar data?   
    Thanks.
  8. Shantimohan
    Shantimohan avatar
    42 posts
    Member since:
    Jul 2012

    Posted 04 Jul 2012 Link to this post

    @Wolfsund, Check the 'sample project' link in my post on Jun 24th. Then you will have to make changes mentioned in my yesterday's post. Let me know if you have any issues with the code.

    There is no other restriction in getting phone's appointments other than that 'it is read only'. You can't edit them in place. Also if an appointment is marked 'private' then you don't get only the start and end date & time. The subject, details and location fields will be null for 'private' marked appointments.

    Hope this helps you.

    ThanQ...
  9. Wolfshund
    Wolfshund avatar
    50 posts
    Member since:
    Feb 2007

    Posted 04 Jul 2012 Link to this post

    @Shantimohan
    Thank you for you help and information.
    I had a first look at your 'sample project' and got some ambiguous marked error messages after opening the project. Just investigating what might be wrong on my side.
    For the private appointments, at least there is enough information to show a 'private appointment' or something else entry.
    Yeah, you're right, the calendar is a great control, I have used it much with custom appointment sources.

    Thanks.
Back to Top
DevCraft banner