diff --git a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml
index 29ed2e5833..b384e1f2c0 100644
--- a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml
+++ b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml
@@ -33,10 +33,6 @@
IsEnabled="False"
Text="Add Marine" />
-
- {
- // See if the job succeeded.
- if (generateGdbJob.Status == JobStatus.Succeeded)
- {
- Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() =>
- {
- // Hide the progress control and update the message.
- LoadingProgressBar.IsVisible = false;
- MessageTextBlock.Text = "Created local geodatabase.";
- });
- }
- else if (generateGdbJob.Status == JobStatus.Failed)
- {
- Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() =>
- {
- // Hide the progress control and report the exception.
- LoadingProgressBar.IsVisible = false;
- MessageTextBlock.Text = "Unable to create local geodatabase: " + generateGdbJob.Error.Message;
- });
- }
- };
-
- // Start the generate geodatabase job.
- _localGeodatabase = await generateGdbJob.GetResultAsync();
+ MessageTextBlock.Text = "Missing local geodatabase.";
}
}
catch (Exception ex)
@@ -206,7 +162,6 @@ private async Task LoadLocalGeodatabaseTables()
{
MyMapView.SetViewpoint(new Viewpoint(_marineTable.Extent));
StartEditingButton.IsEnabled = true;
- SyncEditsButton.IsEnabled = true;
});
}
@@ -222,24 +177,10 @@ private void GdbTransactionStatusChanged(object sender, TransactionStatusChanged
// These buttons should be enabled when there is NOT a transaction.
StartEditingButton.IsEnabled = !e.IsInTransaction;
- SyncEditsButton.IsEnabled = !e.IsInTransaction;
RequireTransactionCheckBox.IsEnabled = !e.IsInTransaction;
});
}
- private string GetGdbPath()
- {
- // Set the platform-specific path for storing the geodatabase.
- string folder = string.Empty;
-#if WINDOWS
- folder = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
-#elif IOS || ANDROID || MACCATALYST
- folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
-#endif
- // Set the final path.
- return Path.Combine(folder, "savethebay.geodatabase");
- }
-
private void BeginTransaction(object sender, EventArgs e)
{
// See if there is a transaction active for the geodatabase.
@@ -385,65 +326,5 @@ private void RequireTransactionChanged(object sender, EventArgs e)
AddBirdButton.IsEnabled = !mustHaveTransaction;
AddMarineButton.IsEnabled = !mustHaveTransaction;
}
-
- // Synchronize edits in the local geodatabase with the service.
- public async void SynchronizeEdits(object sender, EventArgs e)
- {
- // Don't attempt to sync if there are no local edits.
- if (!_localGeodatabase.HasLocalEdits())
- {
- MessageTextBlock.Text = "No local edits to synchronize.";
- return;
- }
-
- // Show the progress bar while the sync is working.
- LoadingProgressBar.IsVisible = true;
-
- try
- {
- // Create a sync task with the URL of the feature service to sync.
- GeodatabaseSyncTask syncTask = await GeodatabaseSyncTask.CreateAsync(new Uri(SyncServiceUrl));
-
- // Create sync parameters.
- SyncGeodatabaseParameters taskParameters = await syncTask.CreateDefaultSyncGeodatabaseParametersAsync(_localGeodatabase);
-
- // Create a synchronize geodatabase job, pass in the parameters and the geodatabase.
- SyncGeodatabaseJob job = syncTask.SyncGeodatabase(taskParameters, _localGeodatabase);
-
- // Handle the JobChanged event for the job.
- job.StatusChanged += (s, arg) =>
- {
- // Report changes in the job status.
- if (job.Status == JobStatus.Succeeded)
- {
- // Report success ...
- Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => MessageTextBlock.Text = "Synchronization is complete!");
- }
- else if (job.Status == JobStatus.Failed)
- {
- // Report failure ...
- Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => MessageTextBlock.Text = job.Error.Message);
- }
- else
- {
- // Report that the job is in progress ...
- Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() => MessageTextBlock.Text = "Sync in progress ...");
- }
- };
-
- // Await the completion of the job.
- await job.GetResultAsync();
- }
- catch (Exception ex)
- {
- // Show the message if an exception occurred.
- MessageTextBlock.Text = "Error when synchronizing: " + ex.Message;
- }
- finally
- {
- // Hide the progress bar when the sync job is complete.
- LoadingProgressBar.IsVisible = false;
- }
- }
}
}
\ No newline at end of file
diff --git a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/geodatabasetransactions.jpg b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/geodatabasetransactions.jpg
index 38bbc58f93..9739cd139d 100644
Binary files a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/geodatabasetransactions.jpg and b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/geodatabasetransactions.jpg differ
diff --git a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.md b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.md
index 5ccf650ca7..b39357e094 100644
--- a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.md
+++ b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.md
@@ -10,15 +10,15 @@ Transactions allow you to control how changes are added to a database. This is u
## How to use the sample
-When the sample loads, a feature service is taken offline as a geodatabase. When the geodatabase is ready, you can add multiple types of features. To apply edits directly, uncheck the 'Require a transaction for edits' checkbox. When using transactions, use the buttons to start editing and stop editing. When you stop editing, you can choose to commit the changes or roll them back. At any point, you can synchronize the local geodatabase with the feature service.
+Tap on the map to add multiple types of features. To apply edits directly, uncheck the "Requires Transaction". When using transactions, use the buttons to start editing and stop editing. When you stop editing, you can choose to commit the changes or roll them back.
## How it works
-1. Take the feature service offline as a geodatabase and display the local tables from the geodatabase in feature layers.
-2. If the checkbox is checked, begin the transaction on the geodatabase.
-3. Add one or more features.
-4. When ready, either commit the transaction to the geodatabase or roll back the transaction.
-5. Use a geodatabase sync task to sync changes to the local geodatabase with the feature service.
+1. Create a `Geodatabase` using the mobile geodatabase file location.
+2. Display the `Geodatabase.FeatureTables` in feature layers.
+3. If a transaction is required, begin one using `Geodatabase.BeginTransaction()`.
+4. Add one or more features to the feature table(s).
+5. When ready, either commit the transaction to the geodatabase with `Geodatabase.CommitTransaction()` or roll back the transaction with `Geodatabase.RollbackTransaction()`.
## Relevant API
@@ -29,9 +29,13 @@ When the sample loads, a feature service is taken offline as a geodatabase. When
* Geodatabase.RollbackTransaction
* GeometryEditor
+## Offline data
+
+This sample downloads the [Save The Bay Geodatabase](https://www.arcgis.com/home/item.html?id=43809fd639f242fd8045ecbafd61a579) item from ArcGIS Online.
+
## About the data
-The sample uses a publicly-editable, sync-enabled [feature service](https://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/SaveTheBaySync/FeatureServer) demonstrating a schema for recording wildlife sightings.
+The mobile geodatabase contains a collection schema for wildlife sightings around Christmas Bay, TX, USA. It was created using data from the [Save The Bay Feature Service](https://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/SaveTheBaySync/FeatureServer).
## Tags
diff --git a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.metadata.json b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.metadata.json
index c861a65ca8..4ca6b7d280 100644
--- a/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.metadata.json
+++ b/src/MAUI/Maui.Samples/Samples/Data/GeodatabaseTransactions/readme.metadata.json
@@ -14,7 +14,9 @@
"transact",
"transactions"
],
- "offline_data": [],
+ "offline_data": [
+ "43809fd639f242fd8045ecbafd61a579"
+ ],
"redirect_from": [
"/net/latest/maui/sample-code/geodatabase-transactions.htm"
],
diff --git a/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.jpg b/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.jpg
index f01958d83c..815f26f592 100644
Binary files a/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.jpg and b/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.jpg differ
diff --git a/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml b/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml
index b2dbd38266..6ad7bc26c3 100644
--- a/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml
+++ b/src/WPF/WPF.Viewer/Samples/Data/GeodatabaseTransactions/GeodatabaseTransactions.xaml
@@ -16,8 +16,11 @@
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- {
- // See if the job succeeded.
- if (generateGdbJob.Status == JobStatus.Succeeded)
- {
- DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () =>
- {
- // Hide the progress control and update the message.
- LoadingProgressBar.Visibility = Visibility.Collapsed;
- MessageTextBlock.Text = "Created local geodatabase.";
- });
- }
- else if (generateGdbJob.Status == JobStatus.Failed)
- {
- DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () =>
- {
- // Hide the progress control and report the exception.
- LoadingProgressBar.Visibility = Visibility.Collapsed;
- MessageTextBlock.Text = "Unable to create local geodatabase: " + generateGdbJob.Error.Message;
- });
- }
- };
-
- // Start the generate geodatabase job.
- _localGeodatabase = await generateGdbJob.GetResultAsync();
+ MessageTextBlock.Text = "Missing local geodatabase.";
}
}
catch (Exception ex)
@@ -220,19 +177,11 @@ private void GdbTransactionStatusChanged(object sender, TransactionStatusChanged
AddMarineButton.IsEnabled = e.IsInTransaction;
StopEditingButton.IsEnabled = e.IsInTransaction;
- // These buttons should be enabled when there is NOT a transaction.
+ // This button should be enabled when there is NOT a transaction.
StartEditingButton.IsEnabled = !e.IsInTransaction;
- SyncEditsButton.IsEnabled = !e.IsInTransaction;
});
}
- private string GetGdbPath()
- {
- // Get the UWP-specific path for storing the geodatabase.
- string folder = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
- return Path.Combine(folder, "savethebay.geodatabase");
- }
-
private void BeginTransaction(object sender, RoutedEventArgs e)
{
// See if there is a transaction active for the geodatabase.
@@ -388,65 +337,5 @@ private void RequireTransactionChanged(object sender, RoutedEventArgs e)
AddBirdButton.IsEnabled = !mustHaveTransaction;
AddMarineButton.IsEnabled = !mustHaveTransaction;
}
-
- // Synchronize edits in the local geodatabase with the service.
- public async void SynchronizeEdits(object sender, RoutedEventArgs e)
- {
- // Don't attempt to sync if there are no local edits.
- if (!_localGeodatabase.HasLocalEdits())
- {
- MessageTextBlock.Text = "No local edits to synchronize.";
- return;
- }
-
- // Show the progress bar while the sync is working.
- LoadingProgressBar.Visibility = Visibility.Visible;
-
- try
- {
- // Create a sync task with the URL of the feature service to sync.
- GeodatabaseSyncTask syncTask = await GeodatabaseSyncTask.CreateAsync(new Uri(SyncServiceUrl));
-
- // Create sync parameters.
- SyncGeodatabaseParameters taskParameters = await syncTask.CreateDefaultSyncGeodatabaseParametersAsync(_localGeodatabase);
-
- // Create a synchronize geodatabase job, pass in the parameters and the geodatabase.
- SyncGeodatabaseJob job = syncTask.SyncGeodatabase(taskParameters, _localGeodatabase);
-
- // Handle the JobChanged event for the job.
- job.StatusChanged += (s, arg) =>
- {
- // Report changes in the job status.
- if (job.Status == JobStatus.Succeeded)
- {
- // Report success ...
- DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => MessageTextBlock.Text = "Synchronization is complete!");
- }
- else if (job.Status == JobStatus.Failed)
- {
- // Report failure ...
- DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => MessageTextBlock.Text = job.Error.Message);
- }
- else
- {
- // Report that the job is in progress ...
- DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => MessageTextBlock.Text = "Sync in progress ...");
- }
- };
-
- // Await the completion of the job.
- await job.GetResultAsync();
- }
- catch (Exception ex)
- {
- // Show the message if an exception occurred.
- MessageTextBlock.Text = "Error when synchronizing: " + ex.Message;
- }
- finally
- {
- // Hide the progress bar when the sync job is complete.
- LoadingProgressBar.Visibility = Visibility.Collapsed;
- }
- }
}
}
\ No newline at end of file
diff --git a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.md b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.md
index 45ac5f28ff..e59dd15be9 100644
--- a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.md
+++ b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.md
@@ -10,15 +10,15 @@ Transactions allow you to control how changes are added to a database. This is u
## How to use the sample
-When the sample loads, a feature service is taken offline as a geodatabase. When the geodatabase is ready, you can add multiple types of features. To apply edits directly, uncheck the 'Require a transaction for edits' checkbox. When using transactions, use the buttons to start editing and stop editing. When you stop editing, you can choose to commit the changes or roll them back. At any point, you can synchronize the local geodatabase with the feature service.
+Tap on the map to add multiple types of features. To apply edits directly, uncheck the "Requires Transaction". When using transactions, use the buttons to start editing and stop editing. When you stop editing, you can choose to commit the changes or roll them back.
## How it works
-1. Take the feature service offline as a geodatabase and display the local tables from the geodatabase in feature layers.
-2. If the checkbox is checked, begin the transaction on the geodatabase.
-3. Add one or more features.
-4. When ready, either commit the transaction to the geodatabase or roll back the transaction.
-5. Use a geodatabase sync task to sync changes to the local geodatabase with the feature service.
+1. Create a `Geodatabase` using the mobile geodatabase file location.
+2. Display the `Geodatabase.FeatureTables` in feature layers.
+3. If a transaction is required, begin one using `Geodatabase.BeginTransaction()`.
+4. Add one or more features to the feature table(s).
+5. When ready, either commit the transaction to the geodatabase with `Geodatabase.CommitTransaction()` or roll back the transaction with `Geodatabase.RollbackTransaction()`.
## Relevant API
@@ -29,9 +29,13 @@ When the sample loads, a feature service is taken offline as a geodatabase. When
* Geodatabase.RollbackTransaction
* GeometryEditor
+## Offline data
+
+This sample downloads the [Save The Bay Geodatabase](https://www.arcgis.com/home/item.html?id=43809fd639f242fd8045ecbafd61a579) item from ArcGIS Online.
+
## About the data
-The sample uses a publicly-editable, sync-enabled [feature service](https://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/SaveTheBaySync/FeatureServer) demonstrating a schema for recording wildlife sightings.
+The mobile geodatabase contains a collection schema for wildlife sightings around Christmas Bay, TX, USA. It was created using data from the [Save The Bay Feature Service](https://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/SaveTheBaySync/FeatureServer).
## Tags
diff --git a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.metadata.json b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.metadata.json
index e792f0363c..6ac9fc7279 100644
--- a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.metadata.json
+++ b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/GeodatabaseTransactions/readme.metadata.json
@@ -14,7 +14,9 @@
"transact",
"transactions"
],
- "offline_data": [],
+ "offline_data": [
+ "43809fd639f242fd8045ecbafd61a579"
+ ],
"redirect_from": [
"/net/latest/winui/sample-code/geodatabase-transactions.htm"
],