/// <summary>
 /// Clears and updates the treeview for Spells. Typically called as part of AddQuality or UpdateCharacterInfo.
 /// </summary>
 /// <param name="treSpells">Treenode that will be cleared and populated.</param>
 /// <param name="cmsSpell">ContextMenuStrip that will be added to each power.</param>
 protected void RefreshSpells(helpers.TreeView treSpells, ContextMenuStrip cmsSpell, Character _objCharacter)
 {
     //Clear the default nodes of entries.
     foreach (TreeNode objNode in treSpells.Nodes)
     {
         objNode.Nodes.Clear();
     }
     //Add the Spells that exist.
     foreach (Spell s in _objCharacter.Spells)
     {
         treSpells.Add(s, cmsSpell, _objCharacter);
     }
 }
Example #2
0
        private void treCharacterList_DragOver(object sender, DragEventArgs e)
        {
            TreeView treSenderView = sender as TreeView;

            if (treSenderView == null)
            {
                return;
            }
            Point    pt      = treSenderView.PointToClient(new Point(e.X, e.Y));
            TreeNode objNode = treSenderView.GetNodeAt(pt).Parent;

            if (objNode.Tag.ToString() != "Watch")
            {
                objNode.BackColor = SystemColors.ControlDark;
            }

            // Clear the background colour for all other Nodes.
            treCharacterList.ClearNodeBackground(objNode);
        }
Example #3
0
        private void treCharacterList_DragDrop(object sender, DragEventArgs e)
        {
            // Do not allow the root element to be moved.
            if (treCharacterList.SelectedNode == null || treCharacterList.SelectedNode.Level == 0 || treCharacterList.SelectedNode.Parent.Tag.ToString() == "Watch")
            {
                return;
            }

            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                TreeView treSenderView = sender as TreeView;
                if (treSenderView == null)
                {
                    return;
                }
                Point    pt = treSenderView.PointToClient(new Point(e.X, e.Y));
                TreeNode nodDestinationNode = treSenderView.GetNodeAt(pt);
                if (nodDestinationNode.Level > 0)
                {
                    nodDestinationNode = nodDestinationNode.Parent;
                }
                if (nodDestinationNode.Tag.ToString() != "Watch")
                {
                    TreeNode       nodNewNode = e.Data.GetData("System.Windows.Forms.TreeNode") as TreeNode;
                    int            intCharacterIndex;
                    CharacterCache objCache = null;
                    if (nodNewNode == null)
                    {
                        return;
                    }
                    if (int.TryParse(nodNewNode.Tag.ToString(), out intCharacterIndex) && intCharacterIndex >= 0 && intCharacterIndex < lstCharacterCache.Count)
                    {
                        objCache = lstCharacterCache[intCharacterIndex];
                    }

                    if (objCache == null)
                    {
                        return;
                    }
                    switch (nodDestinationNode.Tag.ToString())
                    {
                    case "Recent":
                        GlobalOptions.Instance.RemoveFromMRUList(objCache.FilePath, "stickymru");
                        GlobalOptions.Instance.AddToMRUList(objCache.FilePath);
                        break;

                    case "Favourite":
                        GlobalOptions.Instance.RemoveFromMRUList(objCache.FilePath);
                        GlobalOptions.Instance.AddToMRUList(objCache.FilePath, "stickymru");
                        break;

                    default:
                        return;
                    }
                    TreeNode nodClonedNewNode = nodNewNode.Clone() as TreeNode;
                    if (nodClonedNewNode != null)
                    {
                        nodDestinationNode.Nodes.Add(nodClonedNewNode);
                        nodDestinationNode.Expand();
                    }
                    nodNewNode.Remove();
                }
            }
        }