コード例 #1
0
        /// <summary>
        /// Attaches an asset tile to the API handler and it's asset to the right API.
        /// </summary>
        /// <param name="assetTile">The assetTile<see cref="WpfAssetTile"/> to subscribe.</param>
        /// <param name="requestUpdate">If true, the API will request an update for this asset instantly.</param>
        public void AttachAssetTile(IAssetTile assetTile, bool requestUpdate)
        {
            // search the API to subscribe in the dictionary
            IApi api = this.LoadedApis.FirstOrDefault(a => a.ApiInfo.ApiName == assetTile.AssetTileData.ApiName);

            api.AttachAsset(assetTile.AssetTileData.Asset);

            if (api.ApiData.IsEnabled && requestUpdate)
            {
                api.RequestSingleAssetUpdateAsync(assetTile.AssetTileData.Asset);
            }

            this.attachedAssetTiles.Add(assetTile);
        }