public async void ExportTaskItem() { #region Export a Task Item // get the first project task item var taskItem = Project.Current.GetItems <TaskProjectItem>().FirstOrDefault(); // if there isn't a project task item, return if (taskItem == null) { return; } try { // export the task item to the c:\Temp folder string exportFolder = @"c:\temp"; string fileName = await TaskAssistantModule.ExportTaskAsync(taskItem.TaskItemGuid, exportFolder); ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Task saved to " + fileName); } catch (ExportTaskException e) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Error saving task " + e.Message); } #endregion Export a Task Item }
public void Method1Code() { // find the task item which is open var taskItem = Project.Current.GetItems <TaskProjectItem>().FirstOrDefault(t => t.IsOpen == true); // if there isn't a project task item, return if (taskItem == null) { return; } // do something with the task item... eg export it try { // export the task item to the c:\Temp folder TaskAssistantModule.ExportTaskAsync(taskItem.TaskItemGuid, "c:\\temp"); } catch (ExportTaskException e) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Error saving task " + e.Message); } }
protected override async void OnClick() { // get the first taskItem from the project pane var taskItem = Project.Current.GetItems <TaskProjectItem>().FirstOrDefault(); if (taskItem == null) { return; } // use the TaskGuid property on the ProjectItem to obtain the unique identifier for the task item // pass this guid to the ExportTaskAsync method try { string fileName = await TaskAssistantModule.ExportTaskAsync(taskItem.TaskGuid, "c:\\temp"); ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Task saved to " + fileName); } catch (ExportTaskException e) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Error saving task " + e.Message); } }