Beispiel #1
0
 void TreeTypeSort()
 {
     int i;
     TreeNode tn = new TreeNode();
     List<Type> WaitList = new List<Type>();
     treeView1.BeginUpdate();
     treeView1.Nodes.Clear();
     tn.Name = "Base_Class";
     tn.Text = "Товары";
     treeView1.Nodes.Add(tn);
     TreeNode[] tempNode;
     for (i = 0; i < TypeList.Count; i++)
     {
         tempNode = treeView1.Nodes.Find(TypeList[i].BaseType.Name, true);
         if (tempNode.Length > 0)
         {
             tn = new TreeNode();
             selectedObject = ObjList.First(someObject => someObject.GetType().Name == TypeList[i].Name);
             tn.Name = TypeList[i].Name;
             tn.Text = selectedObject.GetName();
             treeView1.SelectedNode = tempNode[0];
             treeView1.SelectedNode.Nodes.Add(tn);
         }
         else
         {
             WaitList.Add(TypeList[i]);
         }
     }
     i = 0;
     while (WaitList.Count != 0)
     {
         i++;
         if (i >= WaitList.Count)
             i -= WaitList.Count;
         tempNode = treeView1.Nodes.Find(WaitList[i].BaseType.Name, true);
         if (tempNode.Length > 0)
         {
             tn = new TreeNode();
             selectedObject = ObjList.First(someObject => someObject.GetType().Name == TypeList[i].Name);
             tn.Name = TypeList[i].Name;
             tn.Text = selectedObject.GetName(); 
             treeView1.SelectedNode = tempNode[0];
             treeView1.SelectedNode.Nodes.Add(tn);
             WaitList.RemoveAt(i);
             i--;
         }
     }
     treeView1.Sort();
     treeView1.EndUpdate();
 }
Beispiel #2
0
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (treeView1.SelectedNode.Name == "Base_Class")
     {
         textBox_Name.Text = "";
         textBox_Cost.Text = "";
         textBox_Desc.Text = "";
     }
     else
     {
         selectedObject = ObjList.First(someObject => someObject.GetType().Name == treeView1.SelectedNode.Name);
         textBox_Name.Text = selectedObject.GetName();
         
         textBox_Desc.Text = selectedObject.description;
         if (treeView1.SelectedNode.Name.Contains("Base_"))
         {
             textBox_Cost.Text = "";
             tasksToolStripMenuItem.Enabled = false;
         }
         else
         {
             textBox_Cost.Text = selectedObject.cost.ToString();
             tasksToolStripMenuItem.Enabled = true;
         }
         UpdateDataGrid(selectedObject);
     }
 }
Beispiel #3
0
 void AlphabetTypeSort()
 {
     int i;
     TreeNode tn = new TreeNode();
     List<Type> WaitList = new List<Type>();
     treeView1.BeginUpdate();
     treeView1.Nodes.Clear();
     tn.Name = "Base_Class";
     tn.Text = "Товары";
     treeView1.Nodes.Add(tn);
     for (i = 0; i < TypeList.Count; i++)
     {
         if (!TypeList[i].Name.Contains("Base_"))
         {
             tn = new TreeNode();
             selectedObject = ObjList.First(someObject => someObject.GetType().Name == TypeList[i].Name);
             tn.Name = TypeList[i].Name;
             tn.Text = selectedObject.GetName();
             treeView1.Nodes[0].Nodes.Add(tn);
         }
     }
     treeView1.Sort();
     treeView1.EndUpdate();
 }