We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

I could not add meeting on calendar

Thread ID:

Created:

Updated:

Platform:

Replies:

132429 Aug 31,2017 10:06 PM Sep 1,2017 03:19 AM Xamarin.Android 1
loading
Tags: SfSchedule
Ishwor Khanal
Asked On August 31, 2017 10:06 PM

I tried this way to add meeting on calendar but was unable to see on screen.

 private void CreateCalendarEvents(ScheduleAppointmentCollection Meetings)
            {
                Meetings = new ScheduleAppointmentCollection();
                ScheduleAppointment meeting = new ScheduleAppointment();
                Calendar calendar = Calendar.Instance;
                Calendar startTimeCalendar = Calendar.Instance;
                foreach (var calendarEvent in remoteData)
                {
                    var DefaultHour = 9;                  
                    if (!string.IsNullOrEmpty(calendarEvent.start) && !string.IsNullOrEmpty(calendarEvent.end))
                    {
                        var startDate = GetDate(calendarEvent.start);
                        var startYear = startDate.Year;
                        var startMonth = startDate.Month;
                        var startDay = startDate.Day;
                        var startTime = GetDate(calendarEvent.start);
                      
                        var startHour = startTime.Hour == 0 ? DefaultHour : startTime.Hour;
                        var startMinute = startTime.Minute;
                        var endDate = GetDate(calendarEvent.end);
                        var endYear = endDate.Year;
                        var endMonth = endDate.Month;
                        var endDay = endDate.Day;
                        var endTime = GetDate(calendarEvent.end);
                        var endHour = endTime.Hour==0 ? DefaultHour : endTime.Hour;
                        var endMinute = endTime.Minute;
                      
                       // startTimeCalendar.Set(calendar.Get(CalendarField.Year), calendar.Get(CalendarField.Month), calendar.Get(CalendarField.Date), hour, 0);
                      
                        startTimeCalendar.Set(startYear, startMonth, calendar.Get(CalendarField.Date), startHour, startMinute, 0);
                        meeting.StartTime = startTimeCalendar;
                        Calendar endTimeCalendar = Calendar.Instance;
                        endTimeCalendar.Set(endYear, endMonth, calendar.Get(CalendarField.Date), endHour, endMinute, 0);
                        meeting.EndTime = endTimeCalendar;
                        meeting.Color = GetColor(calendarEvent.color);
                        meeting.Subject = calendarEvent.title ?? "";
                        meeting.IsAllDay = calendarEvent.allDay;
                        meeting.Notes = calendarEvent.title ?? "";
                        Meetings.Add(meeting);
                    }
                   
                }

            }  


  private int GetColor(string color)
            {
                var defaultColor = "#086A87";
                try
                {
                    if(!string.IsNullOrEmpty(color))
                    {
                        return Color.ParseColor(color);
                    }
                    return Color.ParseColor(defaultColor);
                }catch(Exception ex)
                {
                    Log.Debug(TAG, ex.StackTrace);
                    return Color.ParseColor(defaultColor);
                }
            }       
            private DateTimeOffset GetDate(string date)
            {
             
                try
                {
                   
                    if(!string.IsNullOrEmpty(date))
                    {
                        return DateTime.Parse(date);
                    }else
                    {
                        return DateTime.UtcNow.AddHours(5).AddMinutes(45);
                    }
                    
                }
                catch(Exception e)
                {
                    var dateTime = DateTimeOffset.Parse(date, System.Globalization.CultureInfo.InvariantCulture);
                    return dateTime;
                }
            }

Nijamudeen Mohamed Sulaiman [Syncfusion]
Replied On September 1, 2017 03:19 AM

Hi Ishwor,

Thanks for your interest in Syncfusion products.

Based on the given details we are unable to reproduce the mentioned issue with SfSchedule.Android. We have prepared a simple sample with the provided code. Please refer the sample in the below link.

If the provided solution does not meet your requirement, could you please provide us more details such as Syncfusion ES Version, ScheduleView, Android device, Android OS version etc. It will be helpful for us to analyze on your requirement and provide you a possible solution.


Regards,
Nijamudeen M.


Attachment: ScheduleAppointments_Android_3abe08d7.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;