public async Task MainMethodCode()
        {
            // TODO - substitute your own .esriTasks file
            string taskFile = @"c:\Tasks\Get Started.esriTasks";

            try
            {
                // retrieve the task item information
                TaskItemInfo taskItemInfo = await TaskAssistantModule.GetTaskItemInfoAsync(taskFile);

                string message = "Name : " + taskItemInfo.Name;
                message += "\r\n" + "Description : " + taskItemInfo.Description;
                message += "\r\n" + "Guid : " + taskItemInfo.Guid.ToString("B");
                message += "\r\n" + "Task Count : " + taskItemInfo.GetTasks().Count();

                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(message, "Task Information");
            }
            catch (OpenTaskException e)
            {
                // exception thrown if task file doesn't exist or has incorrect format
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Information");
            }
            catch (TaskFileVersionException e)
            {
                // exception thrown if task file does not support returning task information
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Information");
            }
        }
示例#2
0
        protected override async void OnClick()
        {
            // get the first taskItem from the project pane
            var taskItem = Project.Current.GetTasks().FirstOrDefault();

            if (taskItem == null)
            {
                return;
            }

            // if it's valid
            if (!taskItem.IsInvalid)
            {
                // use the TaskGuid property on the ProjectItem to obtain the unique identifier for the task item
                // pass this guid to the ExportTask method
                try
                {
                    string fileName = await TaskAssistantModule.ExportTask(taskItem.TaskGuid, "c:\\temp");

                    System.Windows.MessageBox.Show("Task saved to " + fileName);
                }
                catch (ExportTaskException e)
                {
                    System.Windows.MessageBox.Show("Error saving task " + e.Message);
                }
            }
        }
示例#3
0
        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
        }
示例#4
0
 protected override async void OnClick()
 {
     // unload
     if (Module1.Current.taskGuid != Guid.Empty)
     {
         await TaskAssistantModule.CloseTaskAsync(Module1.Current.taskGuid);
     }
 }
 protected override async void OnClick()
 {
     // unload
     if (!string.IsNullOrEmpty(Module1.Current.taskGuid))
     {
         await TaskAssistantModule.CloseTask(Module1.Current.taskGuid);
     }
 }
示例#6
0
        public async void OpenTask()
        {
            #region Retrieve all the Task Items in a Project
            IEnumerable <TaskProjectItem> taskItems = Project.Current.GetItems <TaskProjectItem>();
            foreach (var item in taskItems)
            {
                // do something
            }

            #endregion

            #region Open a Task File (*.esriTasks)
            // Open a task file
            try
            {
                // TODO - substitute your own .esriTasks file to be opened
                string      taskFile = @"c:\Tasks\Get Started.esriTasks";
                System.Guid guid     = await TaskAssistantModule.OpenTaskAsync(taskFile);

                // TODO - retain the guid returned for use with CloseTaskAsync
            }
            catch (OpenTaskException e)
            {
                // exception thrown if task file doesn't exist or has incorrect format
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }

            #endregion

            #region Open a Project 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
            {
                // Open it
                System.Guid guid = await TaskAssistantModule.OpenTaskItemAsync(taskItem.TaskItemGuid);

                // TODO - retain the guid returned for use with CloseTaskAsync
            }
            catch (OpenTaskException e)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }
            #endregion
        }
        protected override async void OnClick()
        {
            // pass an .esriTasks File and it will be added to project and loaded in the Tasks pane
            try
            {
                Guid guid = await TaskAssistantModule.OpenTaskAsync(@"\\sbe1\solutions\Tasks\Get Started.esriTasks");

                // keep the guid for CloseTaskAsync
                Module1.Current.taskGuid = guid;
            }
            catch (OpenTaskException e)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }
        }
示例#8
0
        public void MainMethodCode()
        {
            // find the first project 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;
            }

            // close it
            // NOTE : The task item will also be removed from the project
            TaskAssistantModule.CloseTaskAsync(taskItem.TaskItemGuid);
        }
示例#9
0
        protected override async void OnClick()
        {
            // pass an .esriTasks File and it will be added to project and loaded in the Tasks pane
            try
            {
                string guid = await TaskAssistantModule.OpenTask(@"c:\Tasks\Project Exploration Tasks.esriTasks");

                // keep the guid for CloseTask
                Module1.Current.taskGuid = guid;
            }
            catch (OpenTaskException e)
            {
                System.Windows.MessageBox.Show(e.Message);
            }
        }
示例#10
0
        public async Task MainMethodCode()
        {
            // Open a task file
            try
            {
                // TODO - substitute your own .esriTasks file to be opened
                System.Guid guid = await TaskAssistantModule.OpenTaskAsync(@"c:\Tasks\Get Started.esriTasks");

                // TODO - retain the guid returned for use with CloseTaskAsync
            }
            catch (OpenTaskException e)
            {
                // exception thrown if task file doesn't exist or has incorrect format
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }
        }
示例#11
0
        public async void OpenSpecificTask()
        {
            #region Open a specific Task in a Task File (.esriTasks)

            // TODO - substitute your own .esriTasks file to be opened
            string taskFile = @"c:\Tasks\Get Started.esriTasks";

            try
            {
                // retrieve the task item information
                TaskItemInfo taskItemInfo = await TaskAssistantModule.GetTaskItemInfoAsync(taskFile);

                // find the first task
                TaskInfo taskInfo = taskItemInfo.GetTasks().FirstOrDefault();

                Guid guid = Guid.Empty;
                if (taskInfo != null)
                {
                    // if a task exists, open it
                    guid = await TaskAssistantModule.OpenTaskAsync(taskFile, taskInfo.Guid);
                }
                else
                {
                    // else just open the task item
                    guid = await TaskAssistantModule.OpenTaskAsync(taskFile);
                }

                // TODO - retain the guid returned for use with CloseTaskAsync
            }
            catch (OpenTaskException e)
            {
                // exception thrown if task file doesn't exist or has incorrect format
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }
            catch (TaskFileVersionException e)
            {
                // exception thrown if task file does not support returning task information
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }
            #endregion
        }
示例#12
0
        public async Task MainMethodCode()
        {
            // 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;
            }

            // Open it
            try
            {
                System.Guid guid = await TaskAssistantModule.OpenTaskItemAsync(taskItem.TaskItemGuid);
            }
            catch (OpenTaskException e)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }
        }
        protected override async void OnClick()
        {
            // pass an .esriTasks File and it will be added to project and loaded in the Tasks pane
            try
            {
                string taskFile = @"c:\Tasks\Project Exploration Tasks.esriTasks";
                if (!System.IO.File.Exists(taskFile))
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Cannot find file " + taskFile + ". Check file location.");
                    return;
                }

                Guid guid = await TaskAssistantModule.OpenTaskAsync(taskFile);

                // keep the guid for CloseTaskAsync
                Module1.Current.taskGuid = guid;
            }
            catch (OpenTaskException e)
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message);
            }
        }
示例#14
0
        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);
            }
        }
示例#15
0
        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);
            }
        }
        protected override async void OnClick()
        {
            // obtain task information from an .esriTasks file

            // TODO - substitute your own .esriTasks file
            string taskFile = @"c:\Tasks\Project Exploration Tasks.esriTasks";

            if (!System.IO.File.Exists(taskFile))
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Cannot find file " + taskFile + ". Check file location.");
                return;
            }

            try
            {
                // retrieve the task item information
                TaskItemInfo taskItemInfo = await TaskAssistantModule.GetTaskItemInfoAsync(taskFile);

                string message = "Name : " + taskItemInfo.Name;
                message += "\r\n" + "Description : " + taskItemInfo.Description;
                message += "\r\n" + "Guid : " + taskItemInfo.Guid.ToString("B");
                message += "\r\n" + "Task Count : " + taskItemInfo.GetTasks().Count();

                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(message, "Task Information");
            }
            catch (OpenTaskException e)
            {
                // exception thrown if task file doesn't exist or has incorrect format
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Information");
            }
            catch (TaskFileVersionException e)
            {
                // exception thrown if task file does not support returning task information
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Information");
            }


            // OR   obtain the task information from a task project item

            //// find the first task item in the project
            //var taskItem = Project.Current.GetItems<TaskProjectItem>().FirstOrDefault();
            //// if there isn't a project task item, return
            //if (taskItem == null)
            //  return;

            //string message = await QueuedTask.Run(async () =>
            //{
            //  bool isOpen = taskItem.IsOpen;
            //  Guid taskGuid = taskItem.TaskItemGuid;

            //  string msg = "";
            //  try
            //  {
            //    TaskItemInfo taskItemInfo = await taskItem.GetTaskItemInfoAsync();

            //    msg = "Name : " + taskItemInfo.Name;
            //    msg += "\r\n" + "Description : " + taskItemInfo.Description;
            //    msg += "\r\n" + "Guid : " + taskItemInfo.Guid.ToString("B");
            //    msg += "\r\n" + "Task Count : " + taskItemInfo.GetTasks().Count();

            //    // iterate the tasks in the task item
            //    IEnumerable<TaskInfo> taskInfos = taskItemInfo.GetTasks();
            //    foreach (TaskInfo taskInfo in taskInfos)
            //    {
            //      string name = taskInfo.Name;
            //      Guid guid = taskInfo.Guid;

            //      // do something
            //    }
            //  }
            //  catch (OpenTaskException e)
            //  {
            //    // exception thrown if task file doesn't exist or has incorrect format
            //    msg = e.Message;
            //  }
            //  catch (TaskFileVersionException e)
            //  {
            //    // exception thrown if task file does not support returning task information
            //    msg = e.Message;
            //  }
            //  return msg;
            //});

            //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(message, "Task Information");
        }