您的位置:首页 > 财经 > 金融 > ArcGIS Pro SDK (七)编辑 2 启用编辑

ArcGIS Pro SDK (七)编辑 2 启用编辑

2024/11/16 1:17:31 来源:https://blog.csdn.net/szy13323042191/article/details/139950618  浏览:    关键词:ArcGIS Pro SDK (七)编辑 2 启用编辑

ArcGIS Pro SDK (七)编辑 2 启用编辑

目录

  • ArcGIS Pro SDK (七)编辑 2 启用编辑
    • 1 启用编辑
    • 2 禁用编辑

环境:Visual Studio 2022 + .NET6 + ArcGIS Pro SDK 3.0

1 启用编辑

// 如果没有正在编辑
if (!Project.Current.IsEditingEnabled)
{var res = MessageBox.Show("You must enable editing to use editing tools. Would you like to enable editing?","Enable Editing?", System.Windows.MessageBoxButton.YesNoCancel);if (res == System.Windows.MessageBoxResult.No ||res == System.Windows.MessageBoxResult.Cancel){return;}Project.Current.SetIsEditingEnabledAsync(true);
}

2 禁用编辑

// 如果正在编辑
if (Project.Current.IsEditingEnabled)
{var res = MessageBox.Show("Do you want to disable editing? Editing tools will be disabled","Disable Editing?", System.Windows.MessageBoxButton.YesNoCancel);if (res == System.Windows.MessageBoxResult.No ||res == System.Windows.MessageBoxResult.Cancel){return;}//必须检查编辑if (Project.Current.HasEdits){res = MessageBox.Show("Save edits?", "Save Edits?", System.Windows.MessageBoxButton.YesNoCancel);if (res == System.Windows.MessageBoxResult.Cancel){return;}else if (res == System.Windows.MessageBoxResult.No){Project.Current.DiscardEditsAsync();}else{Project.Current.SaveEditsAsync();}}Project.Current.SetIsEditingEnabledAsync(false);
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com