public IList <WeekViewEvent> OnMonthChange(int newYear, int newMonth)
        {
            // Populate the week view with some events.
            List <WeekViewEvent> events = new List <WeekViewEvent>();

            Java.Util.Calendar startTime = Java.Util.Calendar.Instance;
            startTime.Set(CalendarField.HourOfDay, 3);
            startTime.Set(CalendarField.Minute, 0);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            Java.Util.Calendar endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Add(CalendarField.Hour, 1);
            endTime.Set(CalendarField.Month, newMonth - 1);
            WeekViewEvent _event = new WeekViewEvent(1, getEventTitle(startTime), startTime, endTime);

            _event.Color = Resources.GetColor(Resource.Color.event_color_01);
            events.Add(_event);

            startTime = Java.Util.Calendar.Instance;
            startTime.Set(CalendarField.HourOfDay, 3);
            startTime.Set(CalendarField.Minute, 30);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Set(CalendarField.HourOfDay, 4);
            endTime.Set(CalendarField.Minute, 30);
            endTime.Set(CalendarField.Month, newMonth - 1);
            _event       = new WeekViewEvent(10, getEventTitle(startTime), startTime, endTime);
            _event.Color = Resources.GetColor(Resource.Color.event_color_02);
            events.Add(_event);

            startTime = Java.Util.Calendar.Instance;
            startTime.Set(CalendarField.HourOfDay, 4);
            startTime.Set(CalendarField.Minute, 20);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Set(CalendarField.HourOfDay, 5);
            endTime.Set(CalendarField.Minute, 0);
            _event       = new WeekViewEvent(10, getEventTitle(startTime), startTime, endTime);
            _event.Color = Resources.GetColor(Resource.Color.event_color_03);
            events.Add(_event);

            startTime = Calendar.Instance;
            startTime.Set(CalendarField.HourOfDay, 5);
            startTime.Set(CalendarField.Minute, 30);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Add(CalendarField.HourOfDay, 2);
            endTime.Set(CalendarField.Month, newMonth - 1);
            _event          = new WeekViewEvent(2, getEventTitle(startTime), startTime, endTime);
            _event.Location = "Hinjewadi Pune";
            _event.Color    = Resources.GetColor(Resource.Color.event_color_04);
            events.Add(_event);

            startTime = Java.Util.Calendar.Instance;
            startTime.Set(CalendarField.HourOfDay, 5);
            startTime.Set(CalendarField.Minute, 0);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            startTime.Add(CalendarField.Date, 1);
            endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Add(CalendarField.HourOfDay, 3);
            endTime.Set(CalendarField.Month, newMonth - 1);

            _event          = new WeekViewEvent(3, getEventTitle(startTime), startTime, endTime);
            _event.Location = "Hinjewadi Pune";
            _event.Color    = Resources.GetColor(Resource.Color.event_color_01);
            events.Add(_event);

            startTime = Java.Util.Calendar.Instance;
            startTime.Set(CalendarField.DayOfMonth, 15);
            startTime.Set(CalendarField.HourOfDay, 3);
            startTime.Set(CalendarField.Minute, 0);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Add(CalendarField.HourOfDay, 3);

            _event          = new WeekViewEvent(4, getEventTitle(startTime), startTime, endTime);
            _event.Location = "Hinjewadi Pune";
            _event.Color    = Resources.GetColor(Resource.Color.event_color_02);
            events.Add(_event);

            startTime = Java.Util.Calendar.Instance;
            startTime.Set(CalendarField.DayOfMonth, 1);
            startTime.Set(CalendarField.HourOfDay, 3);
            startTime.Set(CalendarField.Minute, 0);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Add(CalendarField.HourOfDay, 3);
            _event          = new WeekViewEvent(5, getEventTitle(startTime), startTime, endTime);
            _event.Location = "Hinjewadi Pune";
            _event.Color    = Resources.GetColor(Resource.Color.event_color_03);
            events.Add(_event);

            startTime = Java.Util.Calendar.Instance;
            startTime.Set(CalendarField.DayOfMonth, startTime.GetActualMaximum(Java.Util.Calendar.DayOfMonth));
            startTime.Set(CalendarField.HourOfDay, 15);
            startTime.Set(CalendarField.Minute, 0);
            startTime.Set(CalendarField.Month, newMonth - 1);
            startTime.Set(CalendarField.Year, newYear);
            endTime = (Java.Util.Calendar)startTime.Clone();
            endTime.Add(CalendarField.HourOfDay, 3);
            _event       = new WeekViewEvent(5, getEventTitle(startTime), startTime, endTime);
            _event.Color = Android.Graphics.Color.ParseColor("#59dbe0");
            events.Add(_event);

            return(events);
        }
Exemple #2
0
        public int GetLastDayOfMonth()
        {
            var lastdayofmoth = _calendar.GetActualMaximum(CalendarField.DayOfMonth);

            return(lastdayofmoth);
        }