corelibraries-devexpress-dot-xtrascheduler-dot-xml-4148c9da.md
Provides methods used to serialize and de-serialize the RecurrenceInfo object.
Namespace : DevExpress.XtraScheduler.Xml
Assembly : DevExpress.XtraScheduler.v25.2.Core.dll
NuGet Package : DevExpress.Scheduler.Core
public class RecurrenceInfoXmlPersistenceHelper :
XmlPersistenceHelper
Public Class RecurrenceInfoXmlPersistenceHelper
Inherits XmlPersistenceHelper
This code snippet illustrates how to set the appointment’s recurrence info from XML string using the IRecurrenceInfo.FromXml method and create an IRecurrenceInfo object using the RecurrenceInfoXmlPersistenceHelper class.
string head = "<RecurrenceInfo ";
string startText = String.Format("Start = '{0}' " , DateTime.Today.AddHours(3));
string endText = String.Format("End = '{0}' ", DateTime.Today.AddHours(4));
string weekDays = String.Format("Weekdays='{0}' ", 10);
string id = String.Format("Id = '{0}' ", Guid.NewGuid());
string occurrenceCount = String.Format("OccurrenceCount = '{0}' ", 15);
string periodicity = String.Format("Periodicity = '{0}' ", 2);
string range = String.Format("Range = '{0}' ", 1);
string type = String.Format("Type = '{0}' ", 1);
string version = String.Format("Version = '{0}' ", 1);
string tail = " />";
string recurrenceXmlString = (head + startText + endText + weekDays +
id + occurrenceCount + periodicity + range + type + version + tail).Replace("'", "\"");
scheduler.Storage.Appointments.Clear();
Appointment apt = scheduler.Storage.CreateAppointment(AppointmentType.Pattern);
apt.Start = DateTime.Today.AddHours(3);
apt.End = apt.Start.AddHours(2);
apt.Subject = "Recurrence From XML";
// Set appointment recurrence from XML.
apt.RecurrenceInfo.FromXml(recurrenceXmlString);
// Get recurrence info from XML.
IRecurrenceInfo rec = DevExpress.XtraScheduler.Xml.RecurrenceInfoXmlPersistenceHelper.ObjectFromXml(recurrenceXmlString);
apt.Description = recurrenceXmlString + Environment.NewLine + String.Format("Type: {0}",rec.Type);
scheduler.Storage.Appointments.Add(apt);
Dim head As String = "<RecurrenceInfo "
Dim startText As String = String.Format("Start = '{0}' ", Date.Today.AddHours(3))
Dim endText As String = String.Format("End = '{0}' ", Date.Today.AddHours(4))
Dim weekDays As String = String.Format("Weekdays='{0}' ", 10)
Dim id As String = String.Format("Id = '{0}' ", Guid.NewGuid())
Dim occurrenceCount As String = String.Format("OccurrenceCount = '{0}' ", 15)
Dim periodicity As String = String.Format("Periodicity = '{0}' ", 2)
Dim range As String = String.Format("Range = '{0}' ", 1)
Dim type As String = String.Format("Type = '{0}' ", 1)
Dim version As String = String.Format("Version = '{0}' ", 1)
Dim tail As String = " />"
Dim recurrenceXmlString As String = (head & startText & endText & weekDays & id & occurrenceCount & periodicity & range & type & version & tail).Replace("'", """")
scheduler.Storage.Appointments.Clear()
Dim apt As Appointment = scheduler.Storage.CreateAppointment(AppointmentType.Pattern)
apt.Start = Date.Today.AddHours(3)
apt.End = apt.Start.AddHours(2)
apt.Subject = "Recurrence From XML"
' Set appointment recurrence from XML.
apt.RecurrenceInfo.FromXml(recurrenceXmlString)
' Get recurrence info from XML.
Dim rec As IRecurrenceInfo = DevExpress.XtraScheduler.Xml.RecurrenceInfoXmlPersistenceHelper.ObjectFromXml(recurrenceXmlString)
apt.Description = recurrenceXmlString & Environment.NewLine & String.Format("Type: {0}",rec.Type)
scheduler.Storage.Appointments.Add(apt)
Object XmlPersistenceHelper RecurrenceInfoXmlPersistenceHelper
See Also