// if not editing 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); }
// if editing 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; } //we must check for edits 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); }
Target Platforms: Windows 11, Windows 10, Windows 8.1