Skip to content

Commit

Permalink
Refactor edit application logic for feature tables
Browse files Browse the repository at this point in the history
  • Loading branch information
prathameshnarkhede committed Feb 7, 2025
1 parent 5aa7182 commit b44163e
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,27 @@ private async void SaveButton_Click(object sender, RoutedEventArgs e)
// Finish editing.
await _featureForm.FinishEditingAsync();

// Get the service feature table.
var serviceFeatureTable = (ServiceFeatureTable)_featureForm.Feature.FeatureTable;

// Get the service geodatabase.
var serviceGeodatabase = serviceFeatureTable.ServiceGeodatabase;

// Check if the service geodatabase can apply edits.
if (serviceGeodatabase.ServiceInfo?.CanUseServiceGeodatabaseApplyEdits == true)
// Check if the feature table is a service feature table.
if (_featureForm.Feature.FeatureTable is ServiceFeatureTable serviceFeatureTable)
{
// Apply edits to the service geodatabase.
await serviceGeodatabase.ApplyEditsAsync();
}
else
{
// Apply edits to the service feature table.
await serviceFeatureTable.ApplyEditsAsync();
// Get the service geodatabase.
var serviceGeodatabase = serviceFeatureTable.ServiceGeodatabase;

// Check if the service geodatabase can apply edits.
if (serviceGeodatabase.ServiceInfo?.CanUseServiceGeodatabaseApplyEdits == true)
{
// Apply edits to the service geodatabase.
await serviceGeodatabase.ApplyEditsAsync();
}
else
{
// Apply edits to the service feature table.
await serviceFeatureTable.ApplyEditsAsync();
}
}

// Hide the feature form panel.
FeatureFormPanel.Visibility = Visibility.Collapsed;
}
catch (Exception ex)
{
MessageBox.Show($"Error: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
Expand Down

0 comments on commit b44163e

Please sign in to comment.