ArcGISRuntime.WPF.Samples.AuthorMap.AuthorMap.UpdatePortalItemThumbnailAsync C# (CSharp) Метод

UpdatePortalItemThumbnailAsync() приватный Метод

private UpdatePortalItemThumbnailAsync ( string thumbnailImagePath ) : void
thumbnailImagePath string
Результат void
        private async void UpdatePortalItemThumbnailAsync(string thumbnailImagePath)
        {
            // Update the portal item with the thumbnail image passed in
            try
            {
                // Get the map's portal item
                PortalItem newPortalItem = MyMapView.Map.Item as PortalItem;

                // Open the image file
                var thumbnailData = new FileStream(thumbnailImagePath, FileMode.Open);

                // Assign the thumbnail data (file stream) to the content object
                newPortalItem.SetThumbnailWithImage(thumbnailData);

                // Update the portal item with the new content (just the thumbnail will be updated)
                await newPortalItem.UpdateItemPropertiesAsync();               

                // Close the stream and delete the local jpg file from disk
                thumbnailData.Close();
                File.Delete(thumbnailImagePath);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to update thumbnail for portal item: " + ex.Message, "Portal Item Thumbnail");
            }
        }