public CustomizationDemo_WinRT() { InitializeComponent(); customeEditor.DataContext = this; this.schedule = Schedule; var visibleDatesBinding = new Binding { Source = this, Mode = BindingMode.TwoWay, Path = new PropertyPath("VisibleDatesCollection") }; BindingOperations.SetBinding(Schedule, SfSchedule.VisibleDatesProperty, visibleDatesBinding); DateTime currentdate = DateTime.Now.Date; if (currentdate.DayOfWeek == System.DayOfWeek.Friday || currentdate.DayOfWeek == System.DayOfWeek.Saturday) { currentdate = currentdate.SubtractDays(3); } else if (currentdate.DayOfWeek == System.DayOfWeek.Sunday || currentdate.DayOfWeek == System.DayOfWeek.Monday) { currentdate = currentdate.AddDays(3); } AppointmentCollection = new ScheduleAppointmentCollection(); AppointmentCollection.Add(new AppointmentWinRT() { AppointmentType = AppointmentWinRT.AppointmentTypesWinRT.Health, Status = Schedule.AppointmentStatusCollection[0], StartTime = currentdate.AddHours(12), AppointmentTime = currentdate.AddHours(12).ToString("hh:mm tt"), EndTime = currentdate.AddHours(15), Subject = "Checkup", Location = "Chennai", AppointmentBackground = new SolidColorBrush(ColorHelper.FromArgb(255, 236, 12, 12)) }); currentdate = currentdate.AddHours(4); AppointmentCollection.Add(new AppointmentWinRT() { AppointmentType = AppointmentWinRT.AppointmentTypesWinRT.Family, Status = Schedule.AppointmentStatusCollection[0], StartTime = currentdate.Date.SubtractDays(2).AddHours(1), AppointmentTime = currentdate.Date.SubtractDays(2).AddHours(1).ToString("hh:mm tt"), EndTime = currentdate.Date.SubtractDays(2).AddHours(4), Subject = "My B'day", AppointmentBackground = new SolidColorBrush(ColorHelper.FromArgb(255, 180, 31, 125)) }); AppointmentCollection.Add(new AppointmentWinRT() { AppointmentType = AppointmentWinRT.AppointmentTypesWinRT.Office, Status = Schedule.AppointmentStatusCollection[0], StartTime = currentdate.Date.AddDays(2).AddHours(9), AppointmentTime = currentdate.Date.AddDays(2).AddHours(9).ToString("hh:mm tt"), EndTime = currentdate.Date.AddDays(2).AddHours(12), Subject = "Meeting", AppointmentBackground = new SolidColorBrush(ColorHelper.FromArgb(255, 60, 181, 75)) }); schedule.Appointments = AppointmentCollection; ScheduleHeaderStyle mainHeader = new ScheduleHeaderStyle(); mainHeader.HeaderHeight = 0; schedule.VisibleDatesChanging += Schedule_VisibleDatesChanging1; Schedule.ScheduleHeaderStyle = mainHeader; Schedule.AppointmentEditorOpening += schedule_AppointmentEditorOpening; Schedule.ContextMenuOpening += Schedule_PopupMenuOpening; schedule.ScheduleTapped += schedule_ScheduleTapped; }
public GettingStarted_WinRT() { ApplicationLanguages.PrimaryLanguageOverride = "en-US"; this.InitializeComponent(); /// <summary> /// custom data mapping /// </summary> meetings = new ObservableCollection <Meeting>(); viewModel = new ScheduleViewModel(); dataMapping = new ScheduleAppointmentMapping(); dataMapping.SubjectMapping = "EventName"; dataMapping.StartTimeMapping = "From"; dataMapping.EndTimeMapping = "To"; dataMapping.AppointmentBackgroundMapping = "color"; dataMapping.AllDayMapping = "AllDay"; Schedule.AppointmentMapping = dataMapping; meetings = viewModel.ListOfMeeting; Schedule.ItemsSource = meetings; this.DataContext = viewModel; Schedule.AppointmentEditorOpening += Schedule1_AppointmentEditorOpening; Schedule.AppointmentEditorClosed += Schedule1_AppointmentEditorClosed; Schedule.VisibleDatesChanging += Schedule_VisibleDatesChanging; this.Week.IsChecked = true; ScheduleHeaderStyle mainHeader = new ScheduleHeaderStyle(); mainHeader.HeaderHeight = 0; Schedule.ScheduleHeaderStyle = mainHeader; Schedule.AppointmentEditorOpening += Schedule_AppointmentEditorOpening; Schedule.ScheduleTypeChanging += Schedule_ScheduleTypeChanging; }
public RecurrenceAppointment_WinRT() { ApplicationLanguages.PrimaryLanguageOverride = "en-US"; this.InitializeComponent(); DateTime today = DateTime.Now; if (today.Month == 12) { today = today.AddMonths(-1); } else if (today.Month == 1) { today = today.AddMonths(1); } DateTime currentdate = new DateTime(today.Year, today.Month - 1, 1, 0, 0, 0); ScheduleAppointmentCollection AppointmentCollection = new ScheduleAppointmentCollection(); // Daily Recursive Appointment ScheduleAppointment SchApp = new ScheduleAppointment(); SchApp.Subject = "Team Meeting"; SchApp.Notes = "Daily Recurrence"; SchApp.Location = "Meeting Hall 1"; SchApp.StartTime = currentdate; SchApp.EndTime = currentdate.AddHours(4); SchApp.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0xD8, 0x00, 0x73))); // Setting Recurrence Properties RecurrenceProperties RecurrenceProperty = new RecurrenceProperties(); RecurrenceProperty.RecurrenceType = RecurrenceType.Daily; RecurrenceProperty.IsDailyEveryNDays = false; //RecProp.DailyNDays = 2; RecurrenceProperty.IsRangeRecurrenceCount = true; RecurrenceProperty.IsRangeNoEndDate = false; RecurrenceProperty.IsRangeEndDate = false; RecurrenceProperty.RangeRecurrenceCount = 100; // Generating RRule using ScheduleHelper SchApp.RecurrenceRule = ScheduleHelper.RRuleGenerator(RecurrenceProperty, SchApp.StartTime, SchApp.EndTime); SchApp.IsRecursive = true; AppointmentCollection.Add(SchApp); Schedule.Appointments = AppointmentCollection; // Weekly Recursive Appointment ScheduleAppointment SchAppointmentWeek = new ScheduleAppointment(); SchAppointmentWeek.Subject = "Doctor Appointment"; SchAppointmentWeek.Notes = "Weekly Recurrence"; SchAppointmentWeek.Location = "Global Hospital"; SchAppointmentWeek.StartTime = currentdate; SchAppointmentWeek.EndTime = currentdate.AddHours(4); SchAppointmentWeek.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39))); // Setting Recurrence Properties RecurrenceProperties RecurrencePropertyWeek = new RecurrenceProperties(); RecurrencePropertyWeek.RecurrenceType = RecurrenceType.Weekly; RecurrencePropertyWeek.WeeklyEveryNWeeks = 1; RecurrencePropertyWeek.IsWeeklySunday = true; RecurrencePropertyWeek.IsRangeRecurrenceCount = true; RecurrencePropertyWeek.IsRangeNoEndDate = false; RecurrencePropertyWeek.IsRangeEndDate = false; RecurrencePropertyWeek.RangeRecurrenceCount = 20; // Generating RRule using ScheduleHelper SchAppointmentWeek.RecurrenceRule = ScheduleHelper.RRuleGenerator(RecurrencePropertyWeek, SchAppointmentWeek.StartTime, SchAppointmentWeek.EndTime); SchAppointmentWeek.IsRecursive = true; AppointmentCollection.Add(SchAppointmentWeek); // Yearly Recursive Appointment ScheduleAppointment SchAppointmentYear = new ScheduleAppointment(); SchAppointmentYear.Subject = "Wedding Anniversary"; SchAppointmentYear.Notes = "Yearly Recurrence"; SchAppointmentYear.Location = "Home"; SchAppointmentYear.StartTime = currentdate; SchAppointmentYear.EndTime = currentdate.AddHours(4); SchAppointmentYear.AppointmentBackground = new SolidColorBrush((Color.FromArgb(0xFF, 0x00, 0xAB, 0xA9))); // Setting Recurrence Properties using RRule SchAppointmentYear.RecurrenceRule = "FREQ=YEARLY;COUNT=3;BYMONTHDAY=" + (DateTime.Now.Day).ToString() + ";BYMONTH=" + (DateTime.Now.Month).ToString() + ""; SchAppointmentYear.IsRecursive = true; AppointmentCollection.Add(SchAppointmentYear); ScheduleHeaderStyle mainHeader = new ScheduleHeaderStyle(); mainHeader.HeaderHeight = 0; Schedule.ScheduleHeaderStyle = mainHeader; Schedule.VisibleDatesChanging += Schedule_VisibleDatesChanging; }
public ResourceDemo_WinRT() { this.InitializeComponent(); ApplicationLanguages.PrimaryLanguageOverride = "en-US"; this.OrderByResource.IsChecked = false; Random randomValue = new Random(); DateTime today = DateTime.Now; if (today.Month == 12) { today = today.AddMonths(-1); } else if (today.Month == 1) { today = today.AddMonths(1); } int day = (int)today.DayOfWeek; DateTime currentWeek = DateTime.Now.AddDays(-day); DateTime startMonth = new DateTime(today.Year, today.Month - 1, 1, 0, 0, 0); for (int i = 1; i < 30; i += 2) { for (int j = -7; j < 14; j++) { datecoll.Add(currentWeek.Date.AddDays(j).AddHours(randomValue.Next(9, 18))); } } ObservableCollection <SolidColorBrush> brush = new ObservableCollection <SolidColorBrush>(); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39))); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xD8, 0x00, 0x73))); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2))); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8))); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0x96, 0x09))); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x33, 0x99, 0x33))); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xAB, 0xA9))); brush.Add(new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0x71, 0xB8))); AppointmentCollection = new ScheduleAppointmentCollection(); ScheduleAppointmentCollection tempcollection = new ScheduleAppointmentCollection(); AppointmentCollection = tempcollection; int count = 0; for (int index = 0; index < 30; index++) { currentdate = datecoll[randomValue.Next(0, datecoll.Count)]; DateTime nextdate = datecoll[randomValue.Next(0, datecoll.Count)]; count++; ScheduleAppointment appointment1 = new ScheduleAppointment() { StartTime = currentdate, EndTime = currentdate.AddHours(randomValue.Next(0, 2)), Subject = subject[count % subject.Length], Location = "Chennai", AppointmentBackground = brush[index % 3] }; appointment1.ResourceCollection.Add(new Resource() { TypeName = "Doctors", ResourceName = "Dr.Jacob" }); count++; ScheduleAppointment appointment2 = new ScheduleAppointment() { StartTime = nextdate, EndTime = nextdate.AddHours(randomValue.Next(0, 2)), Subject = subject[count % subject.Length], Location = "Chennai", AppointmentBackground = brush[(index + 2) % 3] }; appointment2.ResourceCollection.Add(new Resource() { TypeName = "Doctors", ResourceName = "Dr.Darsy" }); tempcollection.Add(appointment1); tempcollection.Add(appointment2); } Schedule1.AppointmentStatusCollection.Add(new ScheduleAppointmentStatus() { Status = "Temporary" }); this.DataContext = this; (this.Schedule1.ScheduleResourceTypeCollection[0].ResourceCollection[0] as CustomResource).ResourceImageUri = new BitmapImage(new Uri("ms-appx:/Schedule/Assets/emp1.png")); (this.Schedule1.ScheduleResourceTypeCollection[0].ResourceCollection[1] as CustomResource).ResourceImageUri = new BitmapImage(new Uri("ms-appx:/Schedule/Assets/emp2.png")); ScheduleHeaderStyle mainHeader = new ScheduleHeaderStyle(); mainHeader.HeaderHeight = 0; Schedule1.ScheduleHeaderStyle = mainHeader; Schedule1.VisibleDatesChanging += Schedule_VisibleDatesChanging; }