private void btnDetails_Click(object sender, EventArgs e) { if (treeViewLTList.SelectedNode == null) { return; } DockContent detailsForm = null; if (treeViewLTList.SelectedNode.Tag is CurriculumNode) { CurriculumNode curr = treeViewLTList.SelectedNode.Tag as CurriculumNode; detailsForm = new SchoolCurrDetailsForm(curr); detailsForm.Text = curr.Text; } else if (treeViewLTList.SelectedNode.Tag is LearningTaskNode) { LearningTaskNode node = treeViewLTList.SelectedNode.Tag as LearningTaskNode; detailsForm = new SchoolTaskDetailsForm(node.TaskType); detailsForm.Text = node.Text; } if (detailsForm != null) { OpenFloatingOrActivate(detailsForm, DockPanel); } }
private void tree_DragOver(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(TreeNodeAdv[])) && treeViewLTList.DropPosition.Node != null) { TreeNodeAdv draggedNode = (e.Data.GetData(typeof(TreeNodeAdv[])) as TreeNodeAdv[]).First(); TreeNodeAdv parent = treeViewLTList.DropPosition.Node; if (treeViewLTList.DropPosition.Position != NodePosition.Inside) { parent = parent.Parent; } if (IsNodeAncestor(draggedNode, parent)) { e.Effect = DragDropEffects.None; return; } CurriculumNode curr = draggedNode.Tag as CurriculumNode; LearningTaskNode lt = draggedNode.Tag as LearningTaskNode; if (curr != null && parent.Level > 0) // curriculum can only be moved - not set as someone's child { e.Effect = DragDropEffects.None; } else if (lt != null && parent.Level != 1) //LT can only be in curriculum. Not in root, not in other LT { e.Effect = DragDropEffects.None; } else { e.Effect = e.AllowedEffect; } } }
public static CurriculumNode FromCurriculumDesign(CurriculumDesign design) { CurriculumNode node = new CurriculumNode { Text = design.Name, IsChecked = design.Enabled, Description = design.Description }; design.Tasks.Where(x => LearningTaskNode.FromLTDesign(x) != null).ToList().ForEach(x => node.Nodes.Add(LearningTaskNode.FromLTDesign(x))); return(node); }
private void btnNewCurr_Click(object sender, EventArgs e) { CurriculumNode node = new CurriculumNode { Text = "Curr" + m_model.Nodes.Count.ToString() }; m_model.Nodes.Add(node); // Curriculum name directly editable upon creation treeViewLTList.SelectedNode = treeViewLTList.FindNodeByTag(node); NodeTextBox control = (NodeTextBox)treeViewLTList.NodeControls.ElementAt(1); control.BeginEdit(); }
private void LoadCurriculum(string filePath) { string xmlCurr; PlanDesign plan = CurriculumManager.LoadPlanDesign(filePath, out xmlCurr); if (plan == null) { return; } foreach (CurriculumNode curr in CurriculumNode.FromPlanDesign(plan)) { m_model.Nodes.Add(curr); } Properties.School.Default.LastOpenedFile = filePath; Properties.School.Default.Save(); m_savedRepresentation = xmlCurr; m_currentFile = filePath; }
public static CurriculumNode FromCurriculumDesign(CurriculumDesign design) { CurriculumNode node = new CurriculumNode { Text = design.Name, IsChecked = design.Enabled, Description = design.Description }; design.Tasks.Where(x => LearningTaskNode.FromLTDesign(x) != null).ToList().ForEach(x => node.Nodes.Add(LearningTaskNode.FromLTDesign(x))); return node; }
public SchoolCurrDetailsForm(CurriculumNode node) { m_node = node; InitializeComponent(); textBox1.Text = node.Description; }