private async void UpdateDataButton_Click(object sender, RoutedEventArgs e) { PortalItem portalItem = null; try { // Get Portal connection parameters var itemId = ItemIdBox.Text; var portalUrl = PortalUrlBox.Text; // Make sure Portal URL and item ID are specified if (string.IsNullOrEmpty(portalUrl)) { ItemDataBox.Text = "Portal URL must be specified"; return; } if (string.IsNullOrEmpty(itemId)) { ItemDataBox.Text = "Portal Item ID must be specified"; return; } // Update status text to indicate operation in progress StatusText.Text = $"Updating data for item {itemId}..."; // Get the item for the specified Portal and item ID portalItem = await GetPortalItemAsync(portalUrl, itemId, UserNameBox.Text, PasswordBox.Password); // Push the data in the item data textbox to the Portal item await portalItem.UpdateDataAsync(ItemDataBox.Text); } catch (Exception ex) { // An unexpected error occurred - notify user StatusText.Text = "Error updating data"; ItemDataBox.Text = $"Error while attempting to retrieve item data: {ex.Message}\n\nStack trace:\n{ex.StackTrace}"; return; } // Update status text to show operation completion StatusText.Text = $"Data for item \"{portalItem.Title}\" (ID: {portalItem.ItemId}) updated successfully"; }