/// <summary> /// Initializes a new instance of the <see cref="AssetSelectionForm" /> class. /// </summary> /// <param name="assetAttributes">The attributes of the assets to be displayed.</param> /// <param name="allowMultipleSelection">if set to <c>true</c> allow multiple assets to be selected.</param> public AssetSelectionForm(AssetAttributes assetAttributes, bool allowMultipleSelection) : this(allowMultipleSelection) { AssetInfoCollection assetList = ConfigurationServices.AssetInventory.GetAssets(assetAttributes); _assetList = new BindingList <AssetInfo>(assetList.ToList()); assets_GridView.DataSource = _assetList; }
/// <summary> /// Initializes a new instance of the <see cref="AssetSelectionForm" /> class. /// </summary> /// <param name="assetAttributes">The attributes of the assets to be displayed.</param> /// <param name="assetFilter">A function to apply that acts as an additional filter to the displayed assets.</param> /// <param name="allowMultipleSelection">if set to <c>true</c> allow multiple assets to be selected.</param> /// <exception cref="ArgumentNullException"><paramref name="assetFilter" /> is null.</exception> public AssetSelectionForm(AssetAttributes assetAttributes, Func <AssetInfoCollection, AssetInfoCollection> assetFilter, bool allowMultipleSelection) : this(allowMultipleSelection) { if (assetFilter == null) { throw new ArgumentNullException(nameof(assetFilter)); } AssetInfoCollection assetList = ConfigurationServices.AssetInventory.GetAssets(assetAttributes); AssetInfoCollection filteredAssetList = assetFilter(assetList); _assetList = new BindingList <AssetInfo>(filteredAssetList.ToList()); assets_GridView.DataSource = _assetList; }