Пример #1
0
        public TreeNodeAdv CreateNavigationNodes(InventoryEntry entry)
        {
            int[] sortmodes = IEComparisonEngine.CurrentComparer().comparisons;
            int   loopcount = (NavigationLayers < sortmodes.Length) ? NavigationLayers : sortmodes.Length;

            TreeNodeAdv navnode   = null;
            TreeNodeAdv newbranch = null;
            string      currentcategory;
            string      categorytext;

            for (int i = 0; i < loopcount; i++)
            {
                // 0: Name
                // 1: Rarity
                // 2: Category
                // 3: Title
                // 4: Prefix
                // 5: Model
                // 6: Manufacturer
                // 7: Level
                // 8: Key

                switch (sortmodes[i])
                {
                case 2:
                    currentcategory = entry.Category;
                    if (currentcategory == "")
                    {
                        currentcategory = "none";
                    }
                    if (!CategoryLookup.TryGetValue(currentcategory, out categorytext))
                    {
                        currentcategory = "(Unknown)";
                        categorytext    = "(Unknown)";
                    }
                    break;

                case 6:
                    currentcategory = entry.NameParts[0];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Manufacturer";
                    }
                    categorytext = currentcategory;
                    break;

                case 7:
                    currentcategory = "Level " + entry.EffectiveLevel.ToString();
                    categorytext    = currentcategory;
                    break;

                case 3:
                    currentcategory = entry.NameParts[3];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Title";
                    }
                    categorytext = currentcategory;
                    break;

                case 4:
                    currentcategory = entry.NameParts[2];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Prefix";
                    }
                    categorytext = currentcategory;
                    break;

                case 5:
                    currentcategory = entry.NameParts[1];
                    if (currentcategory == "")
                    {
                        currentcategory = "No Model";
                    }
                    categorytext = currentcategory;
                    break;

                case 1:
                    currentcategory = entry.Name;
                    categorytext    = currentcategory;
                    break;

                default:
                    return(navnode);
                }

                //Debugger.Break();
                //if (navnode == null)
                //    newbranch = Tree.FindFirstNodeByTag(currentcategory, false);
                //else
                if (navnode != null)
                {
                    newbranch = navnode.FindFirstByTag(currentcategory, false);
                }
                else
                {
                    newbranch = Tree.Root.FindFirstByTag(currentcategory, false);
                }

                if (newbranch == null)
                {
                    // This category does not exist yet.  Create a node for it.
                    ColoredTextNode data = new ColoredTextNode();
                    data.Tag       = currentcategory;
                    data.ForeColor = Color.LightSkyBlue;
                    if (GlobalSettings.UseColor)
                    {
                        data.Text = categorytext;
                    }
                    else
                    {
                        data.Text = "--- " + categorytext + " ---";
                    }

                    if (navnode == null)
                    {
                        (Tree.Model as TreeModel).Nodes.Add(data);
                        navnode = Tree.Root;
                    }
                    else
                    {
                        navnode.AddNode(data);
                    }

                    newbranch = navnode.Children[navnode.Children.Count - 1];
                    //newbranch = navnode.FindFirstByTag(currentcategory, false);

                    //if (navnode == null)
                    //{
                    //    (Tree.Model as TreeModel).Nodes.Add(data);
                    //    newbranch = Tree.FindNodeByTag(data).Tag as Node;
                    //}
                    //else
                    //    navnode.Nodes.Add(newbranch);
                }
                // Update the navnode then iterate again for the next tier of
                // category nodes until all category nodes are present
                navnode = newbranch;
            }
            return(navnode);
        }
Пример #2
0
 public void Add(InventoryEntry entry)
 {
     Unsorted.Add(entry);
     // Implicit event call to OnEntryAdd occurs here
 }
Пример #3
0
 // 1 references to unused method
 public void Remove(InventoryEntry entry, bool updateSelection)
 {
     this.updateSelection = updateSelection;
     Unsorted.Remove(entry);
     // Implicit event call to OnEntryRemove occurs here
 }
Пример #4
0
 public void OnEntryAdd(InventoryList ilist, InventoryEntry entry)
 {
     Sorted.Add(entry);
     AddToTreeView(entry);
 }
Пример #5
0
 public void OnEntryRemove(InventoryList ilist, InventoryEntry entry)
 {
     Sorted.Remove(entry);
     RemoveFromTreeView(entry, false);
 }
Пример #6
0
        // 0 references
        public void DuplicateSilent(string key)
        {
            InventoryEntry entry = this.Items[key];

            DuplicateSilent(entry);
        }
Пример #7
0
        // 0 references
        public void RemoveSilent(TreeNodeAdv node)
        {
            InventoryEntry entry = node.GetEntry();

            Items.Remove(entry.Key);
        }
Пример #8
0
 // 0 references
 public void RemoveSilent(InventoryEntry entry)
 {
     Items.Remove(entry.Key);
 }
Пример #9
0
 // 1 references to unused method
 public void Remove(InventoryEntry entry)
 {
     Items.Remove(entry.Key);
     OnEntryRemove(entry);
 }
Пример #10
0
 public void AddSilent(InventoryEntry entry)
 {
     entry.Key = db.CreateUniqueKey();
     Items.Add(entry.Key, entry);
 }