-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathRecurrence.cs
124 lines (112 loc) · 4.09 KB
/
Recurrence.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using System;
using Android.Content;
using Com.Syncfusion.Schedule;
using Com.Syncfusion.Schedule.Enums;
using Android.Views;
using Android.Widget;
using Java.Util;
using System.Collections.Generic;
using Android.Graphics;
using Java.Text;
namespace SampleBrowser
{
public class Recurrence : SamplePage, IDisposable
{
public Recurrence()
{
}
private SfSchedule sfschedule;
public override View GetSampleContent(Context con)
{
sfschedule = new SfSchedule(con);
sfschedule.ScheduleView = ScheduleView.MonthView;
sfschedule.FirstDayOfWeek = 1;
GetAppointments();
sfschedule.ItemsSource = appointmentCollection;
MonthViewSettings monthViewSettings = new MonthViewSettings();
monthViewSettings.ShowAppointmentsInline = true;
sfschedule.MonthViewSettings = monthViewSettings;
sfschedule.EnableNavigation = true;
return sfschedule;
}
private ScheduleAppointmentCollection appointmentCollection;
//Creating appointments for ScheduleAppointmentCollection
public void GetAppointments()
{
appointmentCollection = new ScheduleAppointmentCollection();
//Recurrence Appointment 1
ScheduleAppointment appointment1 = new ScheduleAppointment();
Calendar currentDate = Calendar.Instance;
Calendar startTime = (Calendar)currentDate.Clone();
Calendar endTime = (Calendar)currentDate.Clone();
startTime.Set(
currentDate.Get(CalendarField.Year),
currentDate.Get(CalendarField.Month),
currentDate.Get(CalendarField.DayOfMonth),
4,
0,
0);
endTime.Set(
currentDate.Get(CalendarField.Year),
currentDate.Get(CalendarField.Month),
currentDate.Get(CalendarField.DayOfMonth),
6,
0,
0);
appointment1.StartTime = startTime;
appointment1.EndTime = endTime;
appointment1.Color = Color.ParseColor("#FF1BA1E2");
appointment1.Subject = "Occurs once in every two days";
RecurrenceProperties recurrenceProp1 = new RecurrenceProperties();
recurrenceProp1.RecurrenceType = RecurrenceType.Daily;
recurrenceProp1.Interval = 2;
recurrenceProp1.RecurrenceRange = RecurrenceRange.Count;
recurrenceProp1.RecurrenceCount = 10;
appointment1.RecurrenceRule = ScheduleHelper.RRuleGenerator(recurrenceProp1, appointment1.StartTime, appointment1.EndTime);
appointmentCollection.Add(appointment1);
//Recurrence Appointment 2
ScheduleAppointment scheduleAppointment1 = new ScheduleAppointment();
Calendar currentDate1 = Calendar.Instance;
Calendar startTime1 = (Calendar)currentDate1.Clone();
Calendar endTime1 = (Calendar)currentDate1.Clone();
startTime1.Set(
currentDate.Get(CalendarField.Year),
currentDate.Get(CalendarField.Month),
currentDate.Get(CalendarField.DayOfMonth),
10,
0,
0);
endTime1.Set(
currentDate.Get(CalendarField.Year),
currentDate.Get(CalendarField.Month),
currentDate.Get(CalendarField.DayOfMonth),
12,
0,
0);
scheduleAppointment1.StartTime = startTime1;
scheduleAppointment1.EndTime = endTime1;
scheduleAppointment1.Color = Color.ParseColor("#FFD80073");
scheduleAppointment1.Subject = "Occurs every Monday";
RecurrenceProperties recurrenceProperties1 = new RecurrenceProperties();
recurrenceProperties1.RecurrenceType = RecurrenceType.Weekly;
recurrenceProperties1.RecurrenceRange = RecurrenceRange.Count;
recurrenceProperties1.Interval = 1;
recurrenceProperties1.WeekDays = WeekDays.Monday;
recurrenceProperties1.RecurrenceCount = 10;
scheduleAppointment1.RecurrenceRule = ScheduleHelper.RRuleGenerator(recurrenceProperties1, scheduleAppointment1.StartTime, scheduleAppointment1.EndTime);
appointmentCollection.Add(scheduleAppointment1);
}
public void OnNothingSelected(object sender, AdapterView.ItemSelectedEventArgs e)
{
sfschedule.ScheduleView = ScheduleView.WeekView;
}
public void Dispose()
{
if (sfschedule != null)
{
sfschedule.Dispose();
sfschedule = null;
}
}
}
}