/// <summary> /// This command shows the basic functionality of how to add a connection to Reviewer Results which are stored in an existing Reviewer workspace. /// </summary> /// <returns></returns> internal static async Task AddReviewerResults_Basic() { try { // You can add only one ResultsProjectItem connection to a project // If FrameworkApplication contains esri_datareviewer_addReviewerWorkspaceSettingState state that means the ResultsProjectItem is already added therefore no need to do anything if (FrameworkApplication.State.Contains(Constants.CanAddReviewerResultsState)) { MessageBox.Show("Data Reviewer results have already been added to the project.", "Warning", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return; } //Get the data folder path string dataRootPath = @"C:\Data\DataReviewer"; //Get path of the Reviewer Workspace string strReviewerResultsWorkspacePath = System.IO.Path.Combine(dataRootPath, "ReviewerWorkspace.gdb"); if (!System.IO.Directory.Exists(strReviewerResultsWorkspacePath)) { MessageBox.Show("Unable to locate " + strReviewerResultsWorkspacePath + " geodatabase", "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); return; } IProjectItem reviewerResultProjectItem = null; await QueuedTask.Run(() => { //Step 1: First check if the Reviewer workspace contains current Reviewer dataset. if (ReviewerUtil.HasValidReviewerDataset(strReviewerResultsWorkspacePath)) { //Step 2: Create the Reviewer ResultsItem reviewerResultProjectItem = ReviewerUtil.CreateResultsProjectItem(strReviewerResultsWorkspacePath); } else { MessageBox.Show("The geodatabase specified does not contain a current Reviewer dataset.", "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); } //Step 3: Add ResultsItem to the current project if (null != reviewerResultProjectItem) { try { bool itemAdded = Project.Current.AddItem(reviewerResultProjectItem); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); } } }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); } }
/// <summary> /// This command shows how to add a connection to Reviewer Results which are stored in an existing Reviewer workspace. /// In this example you can browse to a Reviewer workspace /// </summary> /// <returns></returns> internal static async Task AddReviewerResults_Advanced() { try { // You can add only one ResultsProjectItem connection to a project // If FrameworkApplication contains esri_datareviewer_addReviewerWorkspaceSettingState state that means the ResultsProjectItem is already added therefore no need to do anything if (FrameworkApplication.State.Contains(Constants.CanAddReviewerResultsState)) { MessageBox.Show("Data Reviewer results have already been added to the project.", "Warning", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return; } //Step 1: Browse to a Reviewer Workspace and get its path string strReviewerResultsWorkspacePath = OpenBrowseGeodatabaseDialog(); if (string.IsNullOrEmpty(strReviewerResultsWorkspacePath)) { return; } IProjectItem reviewerResultProjectItem = null; await QueuedTask.Run(() => { //Step 2: Check if the Reviewer workspace contains current Reviewer dataset. if (ReviewerUtil.HasValidReviewerDataset(strReviewerResultsWorkspacePath)) { //Step 3: Create the Reviewer ResultsItem reviewerResultProjectItem = ReviewerUtil.CreateResultsProjectItem(strReviewerResultsWorkspacePath); } else { MessageBox.Show("The geodatabase specified does not contain a current Reviewer dataset.", "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); } //Step 4: Add ResultsItem to the current project if (null != reviewerResultProjectItem) { Project.Current.AddItem(reviewerResultProjectItem); } }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); } }