Пример #1
0
        bool isConnectionRemoved = false;//this flag checks if the connection is removed first and then inserted. Only in this sequence we can raise the NodeConnectionsChanged event properly
        void NodeRelationDescriptor_ConnectionsChanged(CollectionExEventArgs evtArgs)
        {
            if (evtArgs.Element != null)
            {
                ConnectorBase connector = ((EndPoint)evtArgs.Element).Container as ConnectorBase;

                if (evtArgs.ChangeType == CollectionExChangeType.Remove)
                {
                    isConnectionRemoved = true;

                    /*bool cancel = RaiseNodeConnectChangingEventHandler( new NodeConnectChangingEventArgs( connector.FromNode, connector.ToNode, evtArgs.ChangeType ) );
                     *
                     * if ( cancel )
                     * {
                     *  evtArgs.Cancel = cancel;
                     * }*/
                    //else
                    //{
                    //}
                }
                else if (evtArgs.ChangeType == CollectionExChangeType.Insert && isConnectionRemoved)
                {
                    //Raise the node connected event handler after the connection gets inserted.
                    RaiseNodeConnectChangedEventHandler(new NodeConnectChangedEventArgs(connector.FromNode, connector.ToNode, evtArgs.ChangeType));
                }
            }
        }
Пример #2
0
 public static void Model_ChildrenChangeComplete(CollectionExEventArgs evt)
 {
     foreach (Node n in evt.Elements)
     {
         if (n is FilledPath)
         {
             (n as FilledPath).FillStyle.ForeColor = Color.Yellow;
             (n as FilledPath).FillStyle.Color     = Color.Green;
             if (evt.ChangeType == Syncfusion.Windows.Forms.Diagram.CollectionExChangeType.Insert)
             {
                 MessageBox.Show(String.Concat(n.Name, " node added"), "Essential Suite Scripting", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else if (evt.ChangeType == Syncfusion.Windows.Forms.Diagram.CollectionExChangeType.Remove)
             {
                 MessageBox.Show(String.Concat(n.Name, " node Removed"), "Essential Suite Scripting", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
 }
Пример #3
0
 void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs)
 {
     if (evtArgs.ChangeType == CollectionExChangeType.Insert)
     {
         if (!(evtArgs.Element is ConnectorBase))
         {
             Group draggedNode = evtArgs.Element as Group;
             foreach (Group node in this.managers)
             {
                 // If the droppednode contains the pinpoint as that of manager node, connect both the nodes
                 if (draggedNode.ContainsPoint(node.PinPoint))
                 {
                     this.ConnectNodes(node, draggedNode);
                 }
             }
             // Update the layout for better appearance of nodes.
             this.UpdateDiagramLayout();
         }
     }
 }
Пример #4
0
 public static void View_SelectionChanged(CollectionExEventArgs evt)
 {
     foreach (Node n in evt.Elements)
     {
         if (n is FilledPath)
         {
             FilledPath shapenode = (n as FilledPath);
             Color      fillcolor = shapenode.FillStyle.Color;
             if (fillcolor == Color.Red)
             {
                 shapenode.FillStyle.Color = Color.Green;
             }
             else if (fillcolor == Color.Green)
             {
                 shapenode.FillStyle.Color = Color.Blue;
             }
             else
             {
                 shapenode.FillStyle.Color = Color.Red;
             }
         }
     }
 }
Пример #5
0
 void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
 {
     listBox1.Items.Add("\nNodeCollectionChanging event Fired.\n");
 }
Пример #6
0
 void EventSink_SelectionListChanging(CollectionExEventArgs evtArgs)
 {
     listBox1.Items.Add("\nSelectionListChanging event Fired.\n");
 }
Пример #7
0
 protected override void Document_NodeCollectionChanged(CollectionExEventArgs evtArgs)
 {
     base.Document_NodeCollectionChanged(evtArgs);
     if (_inited)
     {
         if (evtArgs.ChangeType != CollectionExChangeType.Set)
         {
             CheckSelection();
         }
     }
 }
Пример #8
0
        protected void OnSelectionChanged(CollectionExEventArgs evtArgs)
        {
            DiagramController controller = this.diagramComponent.Controller;

            if (controller != null)
            {
                if (controller.SelectionList != null)
                {
                    // Check for grouping and ungrouping tools available.
                    bool bGroupAvailable = false;
                    bool bGroupPresent   = false;

                    if (controller.View.SelectionList.Count >= 2)
                    {
                        bGroupAvailable = true;
                    }

                    foreach (Node curNode in controller.View.SelectionList)
                    {
                        // Check for groups.
                        if (curNode is Group)
                        {
                            bGroupPresent = true;
                            break;
                        }
                    }

                    // Update group and ungroup tools.
                    this.barItemGroup.Enabled   = bGroupAvailable;
                    this.barItemUngroup.Enabled = bGroupPresent;

                    SelectionFormat fmtSelection = controller.TextEditor.GetSelectionFormat(false);

                    if (fmtSelection.Valid)
                    {
                        // 1 - FontStyles
                        // Bold
                        barItemBoldText.Checked =
                            ((fmtSelection.FontStyle & System.Drawing.FontStyle.Bold) == System.Drawing.FontStyle.Bold) ? true : false;
                        // Underline
                        barItemUnderlineText.Checked =
                            ((fmtSelection.FontStyle & System.Drawing.FontStyle.Underline) == System.Drawing.FontStyle.Underline) ? true : false;
                        // Italic
                        barItemItalicText.Checked =
                            ((fmtSelection.FontStyle & System.Drawing.FontStyle.Italic) == System.Drawing.FontStyle.Italic) ? true : false;
                        // Strikeout
                        barItemStrikeoutText.Checked =
                            ((fmtSelection.FontStyle & System.Drawing.FontStyle.Strikeout) == System.Drawing.FontStyle.Strikeout) ? true : false;

                        // 2 - Alignment
                        switch (fmtSelection.Alignment)
                        {
                        case StringAlignment.Near:
                            this.CurrentAlignment = this.barItemAlignTextLeft;
                            break;

                        case StringAlignment.Center:
                            this.CurrentAlignment = this.barItemCenterText;
                            break;

                        case StringAlignment.Far:
                            this.CurrentAlignment = this.barItemAlignTextRight;
                            break;
                        }

                        // 3 - FamilyName
                        this.comboBoxBarItemFontFamily.TextBoxValue = fmtSelection.FontFamily;

                        // 4 - FontHeight
                        if (fmtSelection.FontHeight == 0)
                        {
                            this.comboBoxBarItemPointSize.TextBoxValue = string.Empty;
                        }
                        else
                        {
                            this.comboBoxBarItemPointSize.TextBoxValue = fmtSelection.FontHeight.ToString();
                        }
                    }
                    else
                    {
                        barItemBoldText.Checked      = false;
                        barItemItalicText.Checked    = false;
                        barItemUnderlineText.Checked = false;
                        barItemStrikeoutText.Checked = false;
                    }
                }
            }
        }
Пример #9
0
 void EventSink_ConnectionsChanging(CollectionExEventArgs evtArgs)
 {
     listBox1.Items.Add("\nConnectionsChanging event Fired.\n");
 }
Пример #10
0
        protected override void Document_NodeCollectionChanged(CollectionExEventArgs evtArgs)
        {
            base.Document_NodeCollectionChanged(evtArgs);

            if (evtArgs.ChangeType == CollectionExChangeType.Insert && !internalChanging)
            {
                ActivateTool(ToolDescriptor.SelectTool);
            }
        }