private void dataGrid1_DoubleClick(object sender, System.EventArgs e) { if (dataGrid1.CurrentCell.RowNumber >= 0 && dataGrid1.CurrentCell.RowNumber <= _entries.Length) { _entry = _entries[dataGrid1.CurrentCell.RowNumber]; // get a existing task info DemoTask task = new DemoTask(_entry.TaskId); // start a existing task try { UIPManager.StartNavigationTask(_entry.NavGraphName, task); } catch (UIPException ex) { if (ex.Message.IndexOf("Task not found") > -1) { MessageBox.Show(ex.Message + Environment.NewLine + "Remove the bad <task> element within the <tasks> in tasks.xml file to re-start"); } else { throw ex; } } } }
private void btnLogon_Click_1(object sender, System.EventArgs e) { DemoTask task = new DemoTask(); string nav = "navA"; // set first nav + view, since we are starting fresh _entry = new TaskLogEntry(Guid.Empty, "navA", "Form1", DateTime.Now); // save this entry TaskLog.MakeTaskEntry(_entry); // start a new task UIPManager.StartNavigationTask(nav, task); }
/// <summary> /// Gets all task entries /// </summary> public static TaskLogEntry[] GetTaskEntries() { XmlDocument doc = new XmlDocument(); int idx = 0; TaskLogEntry[] entries; doc.Load(PATH_TASKS_XML); entries = new TaskLogEntry[doc.SelectNodes("tasks/task").Count]; foreach (XmlNode node in doc.SelectNodes("tasks/task")) { entries[idx] = new TaskLogEntry( new Guid(node.SelectSingleNode("@taskid").Value), node.SelectSingleNode("@navgraph").Value, node.SelectSingleNode("@view").Value, DateTime.Parse(node.SelectSingleNode("@time").Value, CultureInfo.CurrentUICulture)); idx++; } return(entries); }
/// <summary> /// Updates the entries file with the specified entry /// </summary> /// <param name="entry">task entry</param> public static void MakeTaskEntry(TaskLogEntry entry) { MakeTaskEntry(entry.TaskId, entry.NavGraphName, entry.ViewName, entry.EntryTime); }