private async Task <T> GetObjectPropertiesAsync <T>(int objectId, ObjectType objectType, ObjectProperty mandatoryProperty, CancellationToken token) { var response = await GetObjectPropertiesRawInternalAsync(objectId, objectType, token).ConfigureAwait(false); var data = ResponseParser.GetObjectProperties <T>(response, ObjectEngine.XmlEngine, mandatoryProperty); if (data is TableSettings) { var table = (TableSettings)(object)data; if (table.scheduleStr == null || PrtgObject.GetId(table.scheduleStr) == -1) { table.schedule = new LazyValue <Schedule>(table.scheduleStr, () => new Schedule(table.scheduleStr)); } else { var schedule = await GetScheduleAsync(PrtgObject.GetId(table.scheduleStr), token).ConfigureAwait(false); table.schedule = new LazyValue <Schedule>(table.scheduleStr, () => schedule); } } ValidateTypedProperties(objectId, objectType, data); return(data); }
private T GetObjectProperties <T>(int objectId, ObjectType objectType, ObjectProperty mandatoryProperty) { var response = GetObjectPropertiesRawInternal(objectId, objectType); var data = ResponseParser.GetObjectProperties <T>(response, ObjectEngine.XmlEngine, mandatoryProperty); if (data is TableSettings) { var table = (TableSettings)(object)data; if (table.scheduleStr == null || PrtgObject.GetId(table.scheduleStr) == -1) { table.schedule = new LazyValue <Schedule>(table.scheduleStr, () => new Schedule(table.scheduleStr)); } else { table.schedule = new LazyValue <Schedule>( table.scheduleStr, () => GetSchedule(PrtgObject.GetId(table.scheduleStr)), LazyThreadSafetyMode.PublicationOnly ); } } ValidateTypedProperties(objectId, objectType, data); return(data); }