CommitAsync() is not called

387
1
Jump to solution
11-08-2018 11:17 PM
deleted-user-WOOhbEScR4vX
New Contributor

Hello,

if I override the functions "CommitAsync()" and "CancelAsync()" from the class "ArcGIS.Desktop.Framework.Contracts.Page" the functions are not called when I press OK or Cancel in the GUI. Can anybody confirm this bug or am I doing something wrong? 

public class ProApplicationSettingsViewModel : Page
     {

          /// <summary>
          /// Invoked when the OK or apply button on the property sheet has been clicked.
          /// </summary>
          /// <returns>A task that represents the work queued to execute in the ThreadPool.</returns>
          /// <remarks>This function is only called if the page has set its IsModified flag to true.</remarks>
          protected override Task CommitAsync()
          {
               MessageBox.Show("OK clicked.");
               return Task.FromResult(0);
          }

          protected override Task ResetAsync()
          {
               return Task.FromResult(true);
          }

          protected override Task CancelAsync()
          {
               return Task.FromResult(true);
          }

          /// <summary>
          /// Called when the page loads because to has become visible.
          /// </summary>
          /// <returns>A task that represents the work queued to execute in the ThreadPool.</returns>
          protected override Task InitializeAsync()
          {
               return Task.FromResult(true);
          }

          /// <summary>
          /// Called when the page is destroyed.
          /// </summary>
          protected override void Uninitialize()
          {
          }
     }

InitializeAsync() and Uninitialize() are working fine.

Thank you for your help.

Best regards.

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

Flag your page as "dirty" - this.IsModified = true - this tells the property sheet that you have changes to commit. This guide might help - it does a step-by-step implementation: https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Custom-settings

View solution in original post

1 Reply
CharlesMacleod
Esri Regular Contributor

Flag your page as "dirty" - this.IsModified = true - this tells the property sheet that you have changes to commit. This guide might help - it does a step-by-step implementation: https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Custom-settings