Saving and Loading Schedules
In This Topic
Saving and loading schedules in NOV Schedule is done by calling one of the Save... or Load... method overloads of the NScheduleView class.
Supported File Formats
Nevron Schedule supports the following schedule document formats:
- Nevron Binary Schedule Format (*.nsb) - a binary based Nevron Schedule format. This format preserves all formatting and settings and provides great loading and saving performance. This is the default format for saving and loading of Schedule documents.
- Nevron XML Schedule Format (*.nsx) - a XML based Nevron Schedule format. This format also preserves all formatting and settings and is backward compatible with older versions of the Nevron Schedule component.
- iCalendar Format (*.ics) - a popular schedule format supported by a large number of products, including Google Calendar, Apple Calendar (formerly iCal), IBM Lotus Notes, Yahoo! Calendar, eM Client, Lightning extension for Mozilla Thunderbird and SeaMonkey, and partially by Microsoft Outlook and Novell GroupWise. This format is preferred when you should export or import appointment data to and from third party schedule applications. Note that it may not preserve all formatting and settings you apply to your schedule and appointments, because it does not support all features Nevron Schedule offers.
Save to File or Stream Directly
To save synchronously to a Nevron Binary Schedule local file call the SaveToLocalFile method of the schedule view. This method doesn't work on sandboxed platforms like Blazor WebAssembly.
Save to a Nevron Binary Schedule file synchronously |
Copy Code
|
scheduleView.SaveToLocalFile(@"D:\Documents\MySchedule.nsb");
|
To save a schedule to a file asynchronously call the SaveToFileAsync method of the schedule view. Calling this method shows a loader over the schedule view until the saving completes. The method returns a promise, which you can use to get notified when the saving completes.
Save to a Nevron Binary Schedule file asynchronously |
Copy Code
|
scheduleView.SaveToFileAsync(@"D:\Documents\MySchedule.ndb").Then(
delegate (bool success)
{
},
delegate (Exception ex)
{
}
);
|
To save a schedule to a stream call the SaveToStream method of the schedule view and pass the schedule format to save to:
Save to Nevron Binary Schedule stream |
Copy Code
|
scheduleView.SaveToStream(stream, NScheduleFormat.NevronBinary);
|
Show a Save File Dialog
To show the standard Save File dialog, use the SaveAsAsync method:
Save File dialog |
Copy Code
|
scheduleView.SaveAsAsync();
|
If you want a specific format to be selected by default, pass it as an argument:
Save File dialog with a specific file format selected |
Copy Code
|
scheduleView.SaveAsAsync(NScheduleFormat.NevronBinary);
|
Load from File or Stream Directly
To load a Nevron Schedule synchronously from a local file call the LoadFromLocalFile method of the schedule view. This method doesn't work on sandboxed platforms like Blazor WebAssembly.
Load a Nevron Binary Schedule file synchronously |
Copy Code
|
scheduleView.LoadFromLocalFile(@"D:\Documents\MySchedule.nsb");
|
To load a Nevron Schedule asynchronously call the LoadFromFileAsync method of the schedule view. Calling this method shows a loader over the schedule view until the loading completes. The method returns a promise, which can be used to get notified when the loading completes.
Load a Nevron Binary Schedule file asynchronously |
Copy Code
|
scheduleView.LoadFromFileAsync(@"D:\Documents\MySchedule.nsb").Then(
delegate (bool success)
{
},
delegate (Exception ex)
{
}
);
|
To load a schedule from a stream call the LoadFromStream method of the schedule view and pass the schedule format to load:
Load from Nevron Binary Schedule stream |
Copy Code
|
scheduleView.LoadFromStream(stream, NScheduleFormat.NevronBinary);
|
Show an Open File Dialog
The OpenFileAsync method shows an Open File dialog with all supported schedule formats:
Open File dialog |
Copy Code
|
scheduleView.OpenFileAsync();
|
If you want a specific format to be selected by default, pass it as an argument:
Open File dialog with a specific file format selected |
Copy Code
|
scheduleView.OpenFileAsync(NScheduleFormat.NevronBinary);
|