/// <summary> /// Creates a new instance of the <see cref="HealthRecordItemDataTable"/> /// class with the specified table view and filter. /// </summary> /// /// <param name="view"> /// The view that the data table should take on the data. /// </param> /// /// <param name="filter"> /// The filter used to gather health record items from the HealthVault /// service. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="filter"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="ArgumentException"> /// The <paramref name="view"/> parameter is /// <see cref="HealthRecordItemDataTableView.SingleTypeTable"/> and /// the <paramref name="filter"/> parameter contains more than one type /// identifier. /// </exception> /// public HealthRecordItemDataTable( HealthRecordItemDataTableView view, HealthRecordFilter filter) { Validator.ThrowIfArgumentNull(filter, "filter", "DataTableFilterNull"); Validator.ThrowArgumentExceptionIf( view == HealthRecordItemDataTableView.SingleTypeTable && filter.TypeIds.Count > 1, "view", "DataTableViewInvalid"); _filter = filter; _view = view; }
/// <summary> /// Creates a new instance of the <see cref="HealthRecordItemDataTable"/> /// class with the specified serialization information. /// </summary> /// /// <param name="info"> /// Serialized information about this data table. /// </param> /// /// <param name="context"> /// The stream context of the serialized information. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="info"/> parameter is <b>null</b>. /// </exception> /// protected HealthRecordItemDataTable( SerializationInfo info, StreamingContext context) : base(info, context) { Validator.ThrowIfArgumentNull(info, "info", "ExceptionSerializationInfoNull"); string filterXml = info.GetString("filter"); if (!String.IsNullOrEmpty(filterXml)) { XPathDocument filterDoc =new XPathDocument(new StringReader(filterXml)); _filter = HealthRecordFilter.CreateFromXml(filterDoc.CreateNavigator()); } _view = (HealthRecordItemDataTableView) Enum.Parse(typeof(HealthRecordItemDataTableView), info.GetString("view")); }