예제 #1
0
        private static IList <PluginMenuPath> ParsePluginMenuPaths(XmlNode node)
        {
            List <PluginMenuPath> pathList = new List <PluginMenuPath>();

            foreach (XmlNode theConnectionPointNode in node.SelectNodes("ConnectionPoints/ConnectionPoint"))
            {
                PluginMenuPath point = new PluginMenuPath();
                point.LocateType = (PluginMenuPathLocateType)(Enum.Parse(
                                                                  typeof(PluginMenuPathLocateType),
                                                                  XmlUtils.GetXmlAttribute(theConnectionPointNode, "menuType"))
                                                              );
                point.MenuIndex      = XmlUtils.GetXmlAttribute(theConnectionPointNode, "menuIndex");
                point.MenuImageIndex = XmlUtils.GetXmlAttribute(theConnectionPointNode, "menuImageIndex");
                point.MenuPathParts  = new List <PluginMenuItemPart>();
                foreach (XmlNode addNode in theConnectionPointNode.SelectNodes("add"))
                {
                    PluginMenuItemPart thePart = new PluginMenuItemPart();
                    thePart.Locate    = XmlUtils.GetXmlAttribute(addNode, "locate");
                    thePart.TextStyle = ParsePluginTextStyle(XmlUtils.GetXmlAttribute(addNode, "text"));
                    point.MenuPathParts.Add(thePart);
                }
                pathList.Add(point);
            }
            return(pathList);
        }
        private TreeView SelectNavigation(ConnectionPointContainer container, PluginMenuPath thePath)
        {
            int index = 0;

            if (int.TryParse(thePath.MenuIndex, out index) && index < container.Navigations.Count)
            {
                return(container.Navigations[index]);
            }
            return(null);
        }
예제 #3
0
 public override void AddIntoMenu(ConnectionPointContainer container, PluginConfigItem theItem, PluginMenuPath thePath, ExecutePluginCallback callback)
 {
     if (container.ToolStrips != null && container.ToolStrips.Count > 0)
     {
         ToolBar theToolbar = SelectToolStrip(container, thePath);
         if (theToolbar != null)
         {
             AddMenuItemIntoMenu(container, theToolbar.Items, theItem, thePath, thePath.MenuPathParts, callback);
         }
     }
 }
예제 #4
0
 private ToolBar SelectToolStrip(ConnectionPointContainer container, PluginMenuPath thePath)
 {
     int index = 0;
     if (int.TryParse(thePath.MenuIndex, out index) && container.ToolStrips.Count > index)
         return container.ToolStrips[index];
     else
         foreach (ToolBar theToolbar in container.ToolStrips)
             if (theToolbar.Name == thePath.MenuIndex)
                 return theToolbar;
     return null;
 }
 public override void AddIntoMenu(ConnectionPointContainer container, PluginConfigItem theItem, PluginMenuPath thePath, ExecutePluginCallback callback)
 {
     if (container.Navigations != null && container.Navigations.Count > 0)
     {
         TreeView theTree = SelectNavigation(container, thePath);
         if (theTree != null)
         {
             AddTreeNodeIntoTree(container, theTree.Nodes, theItem, thePath, thePath.MenuPathParts, callback);
         }
     }
 }
예제 #6
0
 public override void AddIntoMenu(ConnectionPointContainer container, 
                                     PluginConfigItem theItem, 
                                     PluginMenuPath thePath, ExecutePluginCallback callback)
 {
     if (null != container.Menus && container.Menus.Count > 0)
     {
         Menu menu = SelectMenu(container, thePath);
         if (null != menu)
         {
             AddMenuItemIntoMenu(container,
                                 menu.Items,
                                 theItem,
                                 thePath,
                                 thePath.MenuPathParts, callback);
         }
     }
 }
예제 #7
0
 public override void AddIntoMenu(ConnectionPointContainer container,
                                  PluginConfigItem theItem,
                                  PluginMenuPath thePath, ExecutePluginCallback callback)
 {
     if (null != container.Menus && container.Menus.Count > 0)
     {
         Menu menu = SelectMenu(container, thePath);
         if (null != menu)
         {
             AddMenuItemIntoMenu(container,
                                 menu.Items,
                                 theItem,
                                 thePath,
                                 thePath.MenuPathParts, callback);
         }
     }
 }
예제 #8
0
        private Menu SelectMenu(ConnectionPointContainer container, PluginMenuPath thePath)
        {
            int index = 0;

            if (int.TryParse(thePath.MenuIndex, out index) && container.Menus.Count > index)
            {
                return(container.Menus[index]);
            }
            else
            {
                foreach (Menu theMenu in container.Menus)
                {
                    if (theMenu.Name == thePath.MenuIndex)
                    {
                        return(theMenu);
                    }
                }
            }
            return(null);
        }
예제 #9
0
        private ToolStrip SelectToolStrip(ConnectionPointContainer container, PluginMenuPath thePath)
        {
            int index = 0;

            if (int.TryParse(thePath.MenuIndex, out index) && container.ToolStrips.Count > index)
            {
                return(container.ToolStrips[index]);
            }
            else
            {
                foreach (ToolStrip theToolbar in container.ToolStrips)
                {
                    if (theToolbar.Name == thePath.MenuIndex)
                    {
                        return(theToolbar);
                    }
                }
            }
            return(null);
        }
예제 #10
0
        protected void AddTreeNodeIntoTree(ConnectionPointContainer container, TreeNodeCollection nodes, PluginConfigItem theItem, PluginMenuPath thePath, IList<PluginMenuItemPart> thePaths, ExecutePluginCallback callback)
        {
            if (thePaths.Count < 1) return;

            PluginMenuItemPart firstPart = thePaths[0];
            PluginMenuPartStruct menuStruct = GetMenuItemIndex(firstPart, nodes);
            IList<PluginMenuItemPart> otherParts = GetLeavesMenuItemParts(thePaths);

            if (!menuStruct.IsCreate)
            {
                AddTreeNodeIntoTree(container, nodes[menuStruct.Index].Nodes,
                       theItem, thePath, otherParts, callback);
            }
            else
            {
                TreeNode theMenuItem = new TreeNode(firstPart.TextStyle.Text);
                CreateMenuEndItem(firstPart, theMenuItem, GetImageList(container, thePath.MenuImageIndex));

                nodes.Insert(
                    menuStruct.Index,
                    theMenuItem
                );

                if (thePaths.Count > 1)
                {
                    AddTreeNodeIntoTree(container, theMenuItem.Nodes, theItem, thePath, otherParts, callback);
                }
                else
                {
                    theMenuItem.Name = theItem.Url;
                    theMenuItem.Tag = new object[] { theItem, callback };

                    theMenuItem.TreeView.NodeMouseClick -= new TreeNodeMouseClickEventHandler(TreeView_NodeMouseClick);
                    theMenuItem.TreeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(TreeView_NodeMouseClick);

                    return;
                }
            }
        }
예제 #11
0
 public virtual void AddIntoMenu(ConnectionPointContainer container, PluginConfigItem theItem, PluginMenuPath thePath, ExecutePluginCallback callback)
 {
 }
예제 #12
0
 public virtual void AddIntoMenu(ConnectionPointContainer container, PluginConfigItem theItem, PluginMenuPath thePath, ExecutePluginCallback callback)
 {
 }
예제 #13
0
        protected void AddTreeNodeIntoTree(ConnectionPointContainer container, TreeNodeCollection nodes, PluginConfigItem theItem, PluginMenuPath thePath, IList <PluginMenuItemPart> thePaths, ExecutePluginCallback callback)
        {
            if (thePaths.Count < 1)
            {
                return;
            }

            PluginMenuItemPart         firstPart  = thePaths[0];
            PluginMenuPartStruct       menuStruct = GetMenuItemIndex(firstPart, nodes);
            IList <PluginMenuItemPart> otherParts = GetLeavesMenuItemParts(thePaths);

            if (!menuStruct.IsCreate)
            {
                AddTreeNodeIntoTree(container, nodes[menuStruct.Index].Nodes,
                                    theItem, thePath, otherParts, callback);
            }
            else
            {
                TreeNode theMenuItem = new TreeNode(firstPart.TextStyle.Text);
                CreateMenuEndItem(firstPart, theMenuItem, GetImageList(container, thePath.MenuImageIndex));

                nodes.Insert(
                    menuStruct.Index,
                    theMenuItem
                    );

                if (thePaths.Count > 1)
                {
                    AddTreeNodeIntoTree(container, theMenuItem.Nodes, theItem, thePath, otherParts, callback);
                }
                else
                {
                    theMenuItem.Name = theItem.Url;
                    theMenuItem.Tag  = new object[] { theItem, callback };

                    theMenuItem.TreeView.NodeMouseClick -= new TreeNodeMouseClickEventHandler(TreeView_NodeMouseClick);
                    theMenuItem.TreeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(TreeView_NodeMouseClick);

                    return;
                }
            }
        }
예제 #14
0
 public override void AddIntoMenu(ConnectionPointContainer container, PluginConfigItem theItem, PluginMenuPath thePath, ExecutePluginCallback callback)
 {
     if (container.Navigations != null && container.Navigations.Count > 0)
     {
         TreeView theTree = SelectNavigation(container, thePath);
         if (theTree != null)
         {
             AddTreeNodeIntoTree(container, theTree.Nodes, theItem, thePath, thePath.MenuPathParts, callback);
         }
     }
 }
예제 #15
0
 public override void AddIntoMenu(ConnectionPointContainer container, PluginConfigItem theItem, PluginMenuPath thePath, ExecutePluginCallback callback)
 {
     if (container.ToolStrips != null && container.ToolStrips.Count > 0)
     {
         ToolStrip theToolbar = SelectToolStrip(container, thePath);
         if (theToolbar != null)
         {
             AddMenuItemIntoMenu(container, theToolbar.Items, theItem, thePath, thePath.MenuPathParts, callback);
         }
     }
 }
예제 #16
0
 private static IList<PluginMenuPath> ParsePluginMenuPaths(XmlNode node)
 {
     List<PluginMenuPath> pathList = new List<PluginMenuPath>();
     foreach (XmlNode theConnectionPointNode in node.SelectNodes("ConnectionPoints/ConnectionPoint"))
     {
         PluginMenuPath point = new PluginMenuPath();
         point.LocateType = (PluginMenuPathLocateType)(Enum.Parse(
             typeof(PluginMenuPathLocateType),
             XmlUtils.GetXmlAttribute(theConnectionPointNode, "menuType"))
             );
         point.MenuIndex = XmlUtils.GetXmlAttribute(theConnectionPointNode, "menuIndex");
         point.MenuImageIndex = XmlUtils.GetXmlAttribute(theConnectionPointNode, "menuImageIndex");
         point.MenuPathParts = new List<PluginMenuItemPart>();
         foreach (XmlNode addNode in theConnectionPointNode.SelectNodes("add"))
         {
             PluginMenuItemPart thePart = new PluginMenuItemPart();
             thePart.Locate = XmlUtils.GetXmlAttribute(addNode, "locate");
             thePart.TextStyle = ParsePluginTextStyle(XmlUtils.GetXmlAttribute(addNode, "text"));
             point.MenuPathParts.Add(thePart);
         }
         pathList.Add(point);
     }
     return pathList;
 }
예제 #17
0
 private ToolStrip SelectMenu(ConnectionPointContainer container, PluginMenuPath thePath)
 {
     int index = 0;
     if (int.TryParse(thePath.MenuIndex, out index) && container.Menus.Count > index)
         return container.Menus[index];
     else
         foreach (MenuStrip theMenu in container.Menus)
             if (theMenu.Name == thePath.MenuIndex)
                 return theMenu;
     return null;
 }
예제 #18
0
 private TreeView SelectNavigation(ConnectionPointContainer container, PluginMenuPath thePath)
 {
     int index = 0;
     if (int.TryParse(thePath.MenuIndex, out index) && index < container.Navigations.Count)
         return container.Navigations[index];
     return null;
 }
예제 #19
0
        protected void AddMenuItemIntoMenu(ConnectionPointContainer container,
                                           ItemCollection menuItemCollection,
                                           PluginConfigItem theItem,
                                           PluginMenuPath thePath,
                                           IList <PluginMenuItemPart> thePaths, ExecutePluginCallback callback)
        {
            if (thePaths.Count < 1)
            {
                return;
            }

            PluginMenuItemPart         firstPart  = thePaths[0];
            PluginMenuPartStruct       menuStruct = GetMenuItemIndex(firstPart, menuItemCollection);
            IList <PluginMenuItemPart> otherParts = GetLeavesMenuItemParts(thePaths);

            if (!menuStruct.IsCreate)
            {
                AddMenuItemIntoMenu(container,
                                    (menuItemCollection[menuStruct.Index] as MenuItem).Items,
                                    theItem,
                                    thePath,
                                    otherParts, callback);
            }
            else
            {
                if (firstPart.TextStyle.Text.Trim() == "-")
                {
                    menuItemCollection.Insert(menuStruct.Index, new Separator());
                    return;
                }

                MenuItem theMenuItem = new MenuItem()
                {
                    Header = firstPart.TextStyle.Text
                };

                CreateMenuEndItem(firstPart, theMenuItem, GetImageList(container, thePath.MenuImageIndex));
                menuItemCollection.Insert(menuStruct.Index, theMenuItem);

                if (thePaths.Count > 1)
                {
                    AddMenuItemIntoMenu(container, theMenuItem.Items, theItem, thePath, otherParts, callback);
                }
                else
                {
                    theMenuItem.Name = theItem.Url;
                    theMenuItem.Tag  = new object[] { theItem, callback };
                    string[] behaviors = theItem.Behavior.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string action in behaviors)
                    {
                        PluginConfigItemBehaviorMode theBehavior = (PluginConfigItemBehaviorMode)Enum.Parse(typeof(PluginConfigItemBehaviorMode), action, true);
                        switch (theBehavior)
                        {
                        case PluginConfigItemBehaviorMode.Click:
                            theMenuItem.Click -= TheMenuItem_Click;
                            theMenuItem.Click += TheMenuItem_Click;
                            break;

                        case PluginConfigItemBehaviorMode.MouseOver:
                            theMenuItem.MouseMove -= TheMenuItem_MouseMove;
                            theMenuItem.MouseMove += TheMenuItem_MouseMove;
                            break;
                        }
                    }
                    return;
                }
            }
        }
예제 #20
0
        protected void AddMenuItemIntoMenu(ConnectionPointContainer container, ToolStripItemCollection toolStripItemCollection, PluginConfigItem theItem, PluginMenuPath thePath, IList<PluginMenuItemPart> thePaths, ExecutePluginCallback callback)
        {
            if (thePaths.Count < 1) return;

            PluginMenuItemPart firstPart = thePaths[0];
            PluginMenuPartStruct menuStruct = GetMenuItemIndex(firstPart, toolStripItemCollection);
            IList<PluginMenuItemPart> otherParts = GetLeavesMenuItemParts(thePaths);

            if (!menuStruct.IsCreate)
            {
                AddMenuItemIntoMenu(container, (toolStripItemCollection[menuStruct.Index] as
                    ToolStripMenuItem).DropDownItems,
                    theItem, thePath, otherParts, callback);

            }
            else
            {
                if (firstPart.TextStyle.Text.Trim() == "-")
                {
                    toolStripItemCollection.Insert(
                        menuStruct.Index,
                        new ToolStripSeparator()
                    );
                    return;
                }
                ToolStripMenuItem theMenuItem = new ToolStripMenuItem(firstPart.TextStyle.Text);

                CreateMenuEndItem(firstPart, theMenuItem, GetImageList(container, thePath.MenuImageIndex));
                toolStripItemCollection.Insert(
                    menuStruct.Index,
                    theMenuItem
                );

                if (thePaths.Count > 1)
                {
                    AddMenuItemIntoMenu(container, theMenuItem.DropDownItems, theItem, thePath, otherParts, callback);
                }
                else
                {
                    theMenuItem.Name = theItem.Url;
                    theMenuItem.Tag = new object[] { theItem, callback };
                    string[] behaviors = theItem.Behavior.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string action in behaviors)
                    {
                        PluginConfigItemBehaviorMode theBehavior = (PluginConfigItemBehaviorMode)Enum.Parse(typeof(PluginConfigItemBehaviorMode), action, true);
                        switch (theBehavior)
                        {
                            case PluginConfigItemBehaviorMode.Click:
                                theMenuItem.Click -= TheMenuItem_Click;
                                theMenuItem.Click += TheMenuItem_Click;
                                break;
                            case PluginConfigItemBehaviorMode.MouseOver:
                                theMenuItem.MouseMove -= new MouseEventHandler(TheMenuItem_MouseMove);
                                theMenuItem.MouseMove += new MouseEventHandler(TheMenuItem_MouseMove);
                                break;
                        }
                    }
                    return;
                }
            }
        }