Example #1
0
        private void ShowNodeContextMenu(object nodeProxy)
        {
            Thread.Sleep(300);

            // put it on the UI thread to execute.
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (!_mouseMovedWhileRMBDown)
                {
                    NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>();
                    if (nrh.FromNode != null)
                    {
                        nrh.FromNode = null;
                    }
                    if (this.uxMapSurface.Children.Contains(_tempRelationshipLine))
                    {
                        this.uxMapSurface.Children.Remove(_tempRelationshipLine);
                    }
                    NodeContextMenu contextMenu = new NodeContextMenu(nodeProxy as INodeProxy, this, _nodeService, _currentMousePosition);
                    ContextMenuService.SetContextMenu(this, contextMenu);

                    contextMenu.IsOpen           = true;
                    contextMenu.HorizontalOffset = _currentMousePosition.X;
                    contextMenu.VerticalOffset   = _currentMousePosition.Y + 30;
                }
            });
        }
Example #2
0
        public ContextMenuCtrl(MainCtrl c, NodeContextMenu nodeContextMenu)
        {
            this.mainCtrl   = c;
            NodeContextMenu = nodeContextMenu;

            NodeContextMenu.mEditNode.Click    += mEditNode_Click;
            NodeContextMenu.mInsertChild.Click += mInsertChild_Click;
            NodeContextMenu.mDeleteNode.Click  += mDeleteNode_Click;
            NodeContextMenu.mSelectIcon.Click  += mSelectIcon_Click;

            NodeContextMenu.mSelectIcon.Image = MindMate.Properties.Resources.smartart_change_color_gallery_16;

            NodeContextMenu.Opening += ContextMenu_Opening;
        }
Example #3
0
 public void InitMindMate(IMainForm mainForm)
 {
     this.mainForm = mainForm;
     MetaModel.MetaModel.Initialize();
     schedular          = new TaskSchedular.TaskSchedular();
     PersistenceManager = new PersistenceManager();
     pluginManager      = new Plugins.PluginManager(this);
     new TabController(this, mainForm);
     pluginManager.Initialize();
     statusBarCtrl   = new WinFormsStatusBarCtrl(mainForm.StatusBar, PersistenceManager);
     NodeContextMenu = new NodeContextMenu();
     mainForm.Load  += mainForm_Load;
     mainForm.Shown += mainForm_AfterReady;
 }
Example #4
0
        private void InsertMenuItems(Plugins.MenuItem[] menuItems, NodeContextMenu nodeContextMenu)
        {
            ContextMenuStrip contextMenu = nodeContextMenu;

            int index = contextMenu.Items.IndexOf(nodeContextMenu.mSepPluginEnd);

            contextMenu.Items.Insert(index++, new ToolStripSeparator());

            foreach (Plugins.MenuItem menu in menuItems)
            {
                contextMenu.Items.Insert(index++, menu.UnderlyingMenuItem);
                menu.UnderlyingMenuItem.Click += PluginMenuItem_Click;
                SetClickHandlerForSubMenu(menu);
            }
        }
Example #5
0
 public void InitMindMate(IMainForm mainForm, DialogManager dialogs)
 {
     this.mainForm = mainForm;
     MetaModel.MetaModel.Initialize();
     schedular          = new TaskScheduler.TaskScheduler();
     PersistenceManager = new PersistenceManager();
     pluginManager      = new Plugins.PluginManager(this);
     new TabController(this, mainForm);
     pluginManager.Initialize();
     Dialogs = dialogs;
     Dialogs.StatusBarCtrl = new WinFormsStatusBarCtrl(mainForm.StatusBar, PersistenceManager);
     NodeContextMenu       = new NodeContextMenu();
     mainForm.Load        += mainForm_Load;
     mainForm.Shown       += mainForm_AfterReady;
     // changing side bar tab gives focus away to tab control header, below event focuses relevant control again
     mainForm.SideBarTabs.SelectedIndexChanged += SideBarTabs_SelectedIndexChanged;
 }
Example #6
0
        public void InitializeContextMenu(NodeContextMenu nodeContextMenu)
        {
            foreach (IPlugin p in Plugins)
            {
                IPluginMapNodeContextMenu plugin = p as IPluginMapNodeContextMenu;
                if (plugin != null)
                {
                    var menu = plugin.CreateContextMenuItemsForNode();
                    if (menu != null)
                    {
                        InsertMenuItems(menu, nodeContextMenu);
                    }
                }
            }

            //register event to notify plugins on context menu opening
            nodeContextMenu.Opening +=
                (s, evt) => this.OnMapNodeContextMenuOpening(mainCtrl.CurrentMapCtrl.MapView.SelectedNodes);
        }
Example #7
0
        private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            treeView.SelectedNode = e.Node;
            UpdateTreeView();

            if (e.Button == MouseButtons.Left)
            {
                UpdateKeysView(e.Node);
            }
            else if (e.Button == MouseButtons.Right)
            {
                if (e.Node.Level == 0)
                {
                    NodeContextMenu.Items[0].Enabled = false;
                }
                else
                {
                    NodeContextMenu.Items[0].Enabled = true;
                }

                if (e.Node.Level > 1)
                {
                    for (int i = 1; i < NodeContextMenu.Items.Count; i++)
                    {
                        NodeContextMenu.Items[i].Enabled = true;
                    }
                }
                else
                {
                    for (int i = 1; i < NodeContextMenu.Items.Count; i++)
                    {
                        NodeContextMenu.Items[i].Enabled = false;
                    }
                }
                NodeContextMenu.Show(treeView, new Point(e.X, e.Y));
            }
        }