TryReadElementFromXml method
Tries to read element from XML.
The reader.
Implementation
@override
Future<bool> TryReadElementFromXml(EwsServiceXmlReader reader) async {
switch (reader.LocalName) {
case XmlElementNames.To:
String? targetKind = reader.ReadAttributeValue(XmlAttributeNames.Kind);
String? targetId = await reader.ReadElementValue<String>();
switch (targetKind) {
case TimeZoneTransition.PeriodTarget:
if (!this.timeZoneDefinition!.Periods.containsKey(targetId)) {
throw new ServiceLocalException("""string.Format(
Strings.PeriodNotFound,
targetId)""");
}
break;
case TimeZoneTransition.GroupTarget:
if (!this
.timeZoneDefinition!
.TransitionGroups
.containsKey(targetId)) {
throw new ServiceLocalException("""string.Format(
Strings.TransitionGroupNotFound,
targetId)""");
}
break;
default:
throw new ServiceLocalException(
"Strings.UnsupportedTimeZonePeriodTransitionTarget");
}
return true;
default:
return false;
}
}