/// <summary> /// Shows a <see cref="TLstTasks" /> Control. /// </summary> /// <param name="ATaskList">The <see cref="TLstTasks" /> Control that should be shown. /// If that Control was alreay shown it is not instantiated again but just brought to the foreground, /// if it wasn't shown before then an instance of it is created automatically.</param> public void ShowTaskList(TLstTasks ATaskList) { if (ATaskList != null) { if (FTaskLists.Contains(ATaskList)) { //TLogging.Log("Found TaskList '" + ATaskList.Name + "' - bringing it to front."); ATaskList.MaxTaskWidth = FMaxTaskWidth; ATaskList.TaskAppearance = FTaskAppearance; ATaskList.SingleClickExecution = FSingleClickExecution; ATaskList.BringToFront(); } else { //TLogging.Log("Couldn't find TaskList '" + ATaskList.Name + "' - adding it."); this.Controls.Add(ATaskList); ATaskList.MaxTaskWidth = FMaxTaskWidth; ATaskList.TaskAppearance = FTaskAppearance; ATaskList.SingleClickExecution = FSingleClickExecution; ATaskList.BringToFront(); FTaskLists.Add(ATaskList); } } }
private void LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { FCurrentTaskList = FDashboard.GetTaskList((XmlNode)((Control)sender).Tag); FCurrentTaskList.Statusbar = FStatusbar; FCurrentTaskList.Dock = DockStyle.Fill; TLstTasks.CurrentLedger = FCurrentLedger; TLstTasks.InitiallySelectedLedger = FInitiallySelectedLedger; FDashboard.ShowTaskList(FCurrentTaskList); }
/// <summary> /// Gets a task list that corresponds to a node in the navigation document. If a list exists already it returns that list. /// If there is no list for that node yet it creates a new one, which will be available next time. /// </summary> /// <param name="ATaskListNode">The node</param> /// <returns></returns> public TLstTasks GetTaskList(XmlNode ATaskListNode) { for (int i = 0; i < FTaskLists.Count; i++) { if (FTaskLists[i].Name.EndsWith(ATaskListNode.Name)) { return(FTaskLists[i]); } } TLstTasks newList = new TLstTasks(ATaskListNode, FTaskAppearance); FTaskLists.Add(newList); return(newList); }
/// <summary> /// Select the last task in the specified task list and set focus to the control /// </summary> private void SelectLastTaskWithFocus(TLstTasks ATaskList) { for (int i = 0; i < ATaskList.Controls.Count; i++) { TUcoTaskGroup group = (TUcoTaskGroup)ATaskList.Controls[i]; for (int k = group.Controls[0].Controls.Count - 1; k >= 0; k--) { TUcoSingleTask task = (TUcoSingleTask)group.Controls[0].Controls[k]; if (task.Enabled) { task.FocusTask(); return; } } } }
/// <summary> /// Shows a <see cref="TLstTasks" /> Control. /// </summary> /// <param name="ATaskList">The <see cref="TLstTasks" /> Control that should be shown. All other controls are hidden. /// This ensures that the TAB key can be used to navigate tasks using the keyboard.</param> public void ShowTaskList(TLstTasks ATaskList) { if (ATaskList != null) { for (int i = 0; i < FTaskLists.Count; i++) { if (FTaskLists[i].Name != ATaskList.Name) { FTaskLists[i].Hide(); } } if (this.Controls.Contains(ATaskList)) { ATaskList.Show(); foreach (TUcoTaskGroup group in ATaskList.Groups.Values) { if (group.FocusSelectedTask()) { break; } } } else { ATaskList.SuspendLayout(); this.Controls.Add(ATaskList); ATaskList.MaxTaskWidth = FMaxTaskWidth; ATaskList.TaskAppearance = FTaskAppearance; ATaskList.SingleClickExecution = FSingleClickExecution; ATaskList.ResumeLayout(); SelectFirstTaskWithFocus(ATaskList); } FCurrentTaskList = ATaskList; } }
/// <summary> /// Select the first task in the specified task list and set focus to the control /// </summary> private void SelectFirstTaskWithFocus(TLstTasks ATaskList) { if (ATaskList == null) { return; } for (int i = ATaskList.Controls.Count - 1; i >= 0; i--) { TUcoTaskGroup group = (TUcoTaskGroup)ATaskList.Controls[i]; for (int k = 0; k < group.Controls[0].Controls.Count; k++) { TUcoSingleTask task = (TUcoSingleTask)group.Controls[0].Controls[k]; if (task.Enabled) { task.FocusTask(); return; } } } }
private void LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { Object tag = ((Control)sender).Tag; if (tag.GetType() == typeof(TLstTasks)) { FCurrentTaskList = (TLstTasks)tag; //TLogging.Log("LinkClicked for existing " + FCurrentTaskList.Name); } else { FCurrentTaskList = new TLstTasks((XmlNode)tag, FDashboard.TaskAppearance); //TLogging.Log("LinkClicked for NEW " + FCurrentTaskList.Name); ((Control)sender).Tag = FCurrentTaskList; } FCurrentTaskList.Statusbar = FStatusbar; FCurrentTaskList.Dock = DockStyle.Fill; TLstTasks.CurrentLedger = FCurrentLedger; FDashboard.ShowTaskList(FCurrentTaskList); // Invalidate(); }