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"); } }
private List <TaskItemInfo> GetUniqueTaskItemInfo() { // Compare paths in a case insensitive manner. var uniqueFullPaths = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var infos = new List <TaskItemInfo>(); foreach (var item in Files) { var fullPath = item.GetMetadata("FullPath"); if (fullPath == null || !File.Exists(fullPath)) { Log.LogWarning("File '{0}' does not exist.", item.ItemSpec); continue; } if (!uniqueFullPaths.Add(fullPath)) { continue; } var info = new TaskItemInfo(item, fullPath); infos.Add(info); } return(infos); }
public async void GetTaskItemInfo_ProjectItem() { #region Get Task Information (TaskProjectItem) 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"); #endregion }
public void Method1Code() { // 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; } try { bool isOpen = taskItem.IsOpen; Guid taskGuid = taskItem.TaskItemGuid; TaskItemInfo taskItemInfo = taskItem.GetTaskItemInfo(); 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 Item Information"); // 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 ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Item Information"); } catch (TaskFileVersionException e) { // exception thrown if task file does not support returning task information ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.Message, "Task Item Information"); } }
private void saveRegisitedTask(SaveData savaData, TaskInterface ti) { TaskInfo taskInfo = new TaskInfo(); taskInfo.TaskCode = ti.getTaskCode(); taskInfo.TaskDesc = ti.getTaskDes(); taskInfo.TaskDistrubtor = ti.getTaskDistributor(); taskInfo.TaskId = ti.getTaskId(); taskInfo.TaskName = ti.getTaskName(); taskInfo.TaskOwner = ti.getTaskOwner(); taskInfo.TaskStatus = ti.getTaskStatus(); taskInfo.TaskType = ti.getTaskType(); List <TaskItemInfo> items = new List <TaskItemInfo>(); foreach (TaskItemInterface tii in ti.getTaskItems()) { TaskItemInfo taskItemInfo = new TaskItemInfo(); taskItemInfo.ItemDesc = tii.getItemDesc(); taskItemInfo.ItemCode = tii.getItemCode(); items.Add(taskItemInfo); } taskInfo.TaskItems = items; taskInfo.AwardAttr = ti.getTaskAwards().getTaskAwardAttrInfo(); List <ItemInfo> awardsItems = new List <ItemInfo>(); if (ti.getTaskAwards().getTaskAwardItemInfo() != null && ti.getTaskAwards().getTaskAwardItemInfo().Count > 0) { foreach (Item it in ti.getTaskAwards().getTaskAwardItemInfo()) { ItemInfo ii = new ItemInfo(); ii.Code = it.getCode(); ii.Desc = it.getDesc(); ii.Durability = it.getDurability(); ii.Name = it.getName(); ii.Type = it.getType(); awardsItems.Add(ii); } } taskInfo.Items = awardsItems; savaData.Tasks.Add(taskInfo); }
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 }
/// <summary> /// Initializes a new instance of the TaskItem class with default settings /// </summary> public TaskItem() : base() { // set control styles this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.Selectable, true); this.TabStop = true; this.BackColor = Color.Transparent; // get the system theme settings this.systemSettings = ThemeManager.GetSystemExplorerBarSettings(); this.customSettings = new TaskItemInfo(); this.customSettings.TaskItem = this; this.customSettings.SetDefaultEmptyValues(); // preferred size this.preferredWidth = -1; this.preferredHeight = -1; // unfocused item this.focusState = FocusStates.None; this.Cursor = Cursors.Hand; this.textRect = new Rectangle(); this.TextAlign = ContentAlignment.TopLeft; this.showFocusCues = false; this.useGdiText = false; this.InitStringFormat(); this.InitDrawTextFlags(); }
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; } await QueuedTask.Run(async() => { try { // retrieve the task item information //TaskItemInfo taskItemInfo = await TaskAssistantModule.GetTaskItemInfoAsync(taskFile); 2.x TaskItemInfo taskItemInfo = await TaskAssistantFactory.Instance.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"); }