New to Telerik UI for WinForms? Start a free 30-day trial
Import/Export to a Custom File
Updated over 1 year ago
In order to import/export the scheduler appointments to a custom file you should:
1. Create custom classes for import and export:
C#
public class CustomImporter : ISchedulerImporter
{
public void Import(ISchedulerData data, string stringData)
{
//TODO Parse the string data and fill
//data.GetEventStorage().Add( created event );
}
public void Import(ISchedulerData data, System.IO.Stream stream)
{
//TODO Read stream
//data.GetEventStorage().Add( created event );
}
}
public class CustomExporter : ISchedulerExporter
{
public string Export(ISchedulerData data)
{
string result = string.Empty;
//Save events to string value
//data.GetEventStorage(); - return all events
return result;
}
public void Export(ISchedulerData data, System.IO.Stream stream)
{
//Save events to the stream
//data.GetEventStorage(); - return all events
}
}
2. Then you need to pass the instances of these classes to the Import and Export methods of the scheduler:
C#
//Import
using (FileStream fileStream = File.Create("file name"))
{
this.radScheduler1.Import(fileStream, new CustomImporter());
}
//Export
using (FileStream fileStream = File.Create("file name"))
{
this.radScheduler1.Export(fileStream, new CustomExporter());
}