TryReadElementFromXml method

  1. @override
Future<bool> TryReadElementFromXml(
  1. EwsServiceXmlReader reader
)
override
Tries to read element from XML. The reader.

Implementation

@override
Future<bool> TryReadElementFromXml(EwsServiceXmlReader reader) async {
  switch (reader.LocalName) {
    case XmlElementNames.Offset:
      this._offset = EwsUtilities.XSDurationToTimeSpan(
          (await reader.ReadElementValue<String>())!);
      return true;
    case XmlElementNames.RelativeYearlyRecurrence:
      throw UnimplementedError("XmlElementNames.RelativeYearlyRecurrence");
//                    this.Recurrence = new TimeChangeRecurrence();
//                    this.Recurrence.LoadFromXml(reader, reader.LocalName);
//        return true;
    case XmlElementNames.AbsoluteDate:
      DateTime dateTime =
          DateTime.parse((await reader.ReadElementValue<String>())!);

      // TODO: BUG
      this._absoluteDate = dateTime;
//                    this.absoluteDate = new DateTime(dateTime.ToUniversalTime().Ticks, DateTimeKind.Unspecified);
      return true;
    case XmlElementNames.Time:
      this._time = new misc.Time.fromDateTime(
          DateTime.parse((await reader.ReadElementValue<String>())!));
      return true;
    default:
      return false;
  }
}