Exemple #1
0
        internal void ShowPopUp(string positive, string negative)
        {
            alertBuilder.SetTitle("Enter Text");
            editText.Text = _inputstring;
            editText.FocusableInTouchMode = true;
            editText.RequestFocus();
            editText.SetBackgroundColor(Color.WhiteSmoke);
            editText.SetTextColor(Color.Black);
            alertBuilder.SetView(editText);
            alertBuilder.SetCancelable(false);

            alertBuilder.SetPositiveButton(positive, (senderAlert, args) =>
            {
                diagram.Alpha = 1;
                diagram.PageSettings.BackgroundColor = Color.White;
                if (editText.Text == null)
                {
                    editText.Text = "";
                }
                var node = new Node(diagram.Context);
                if (CurrentHandle == UserHandlePosition.Left)
                {
                    node.OffsetX = SelectedNode.OffsetX - SelectedNode.Width - 100;
                    node.OffsetY = SelectedNode.OffsetY;
                }
                else if (CurrentHandle == UserHandlePosition.Right)
                {
                    node.OffsetX = SelectedNode.OffsetX + SelectedNode.Width + 100;
                    node.OffsetY = SelectedNode.OffsetY;
                }
                node.Width             = SelectedNode.Width;
                node.Height            = SelectedNode.Height;
                node.ShapeType         = ShapeType.RoundedRectangle;
                node.Style.StrokeWidth = 3;
                if (SelectedNode == RootNode)
                {
                    index                  = rnd.Next(5);
                    node.Style.Brush       = new SolidBrush(FColor[index]);
                    node.Style.StrokeBrush = new SolidBrush(SColor[index]);
                }
                else
                {
                    node.Style = SelectedNode.Style;
                }
                node.Annotations.Add(new Annotation()
                {
                    Content = editText.Text, FontSize = 14 * MainActivity.Factor, TextBrush = new SolidBrush(Color.Black)
                });
                diagram.AddNode(node);
                var c1        = new Connector(diagram.Context);
                c1.SourceNode = SelectedNode;
                c1.TargetNode = node;
                //c1.Style.StrokeBrush = node.Style.StrokeBrush;
                //c1.Style.StrokeWidth = 3;
                //c1.TargetDecoratorStyle.Fill = (node.Style.StrokeBrush as SolidBrush).FillColor;
                //c1.TargetDecoratorStyle.StrokeColor = (c1.TargetNode.Style.StrokeBrush as SolidBrush).FillColor;
                //c1.SegmentType = SegmentType.CurveSegment;
                //c1.Style.StrokeStyle = StrokeStyle.Dashed;
                diagram.AddConnector(c1);
                if (CurrentHandle == UserHandlePosition.Left)
                {
                    if (!(diagram.LayoutManager.Layout as MindMapLayout).EnableFreeForm)
                    {
                        (diagram.LayoutManager.Layout as MindMapLayout).UpdateLeftOrTop();
                    }
                }
                else if (CurrentHandle == UserHandlePosition.Right)
                {
                    if (!(diagram.LayoutManager.Layout as MindMapLayout).EnableFreeForm)
                    {
                        (diagram.LayoutManager.Layout as MindMapLayout).UpdateRightOrBottom();
                    }
                }
                m_mindmap.SelectedNode = node;
                m_mindmap.UpdateHandle();
                diagram.Select(node);

                diagram.BringToView(node);
                m_mindmap.UpdateTheme();
            });
            alertBuilder.SetNegativeButton(negative, (senderAlert, args) =>
            {
                alertBuilder.SetCancelable(true);
            });
            alertBuilder.Show();
        }
Exemple #2
0
        public override View GetSampleContent(Context context)
        {
            m_context = context;
            //Initialize the SfDiagram and set its background color.
            diagram = new SfDiagram(context);
            diagram.EnableSelection = false;
            diagram.BackgroundColor = Color.White;
            //Initialize the nodes and set its properties.
            var node1 = DrawNode(280 * 2 * MainActivity.factor, 140 * 2 * MainActivity.factor, 175 * 2 * MainActivity.factor, 70 * 2 * MainActivity.factor, ShapeType.RoundedRectangle);

            node1.Style.StrokeBrush = new SolidBrush(Color.Rgb(206, 98, 9));
            node1.Annotations.Add(new Annotation()
            {
                Content = FlowDiagram.CreateLabel(context, "Establish Project" + "\n" + "and Team", (int)node1.Width, Color.White), HorizontalAlignment = HorizontalAlignment.Center
            });
            diagram.AddNode(node1);

            var node2 = DrawNode(280 * 2 * MainActivity.factor, node1.OffsetY + (140 * 2 * MainActivity.factor), 175 * 2 * MainActivity.factor, 70 * 2 * MainActivity.factor, ShapeType.RoundedRectangle);

            node2.Style.StrokeBrush = new SolidBrush(Color.Rgb(206, 98, 9));
            node2.Style.Brush       = new LinearGradientBrush(0, 30, 150, 30, new Color[] { Color.Rgb(255, 130, 0), Color.Rgb(255, 37, 0) }, null, GradientDrawingOptions.Clamp);
            node2.Style.StrokeWidth = 0;
            node2.Annotations.Add(new Annotation()
            {
                Content = FlowDiagram.CreateLabel(context, "Define Scope", (int)node2.Width, Color.White), HorizontalAlignment = HorizontalAlignment.Center
            });
            diagram.AddNode(node2);

            var node3 = DrawNode(280 * 2 * MainActivity.factor, node2.OffsetY + (140 * 2 * MainActivity.factor), 175 * 2 * MainActivity.factor, 70 * 2 * MainActivity.factor, ShapeType.RoundedRectangle);

            node3.Style.StrokeBrush = new SolidBrush(Color.Rgb(206, 98, 9));
            node3.Style.StrokeStyle = StrokeStyle.Dashed;
            node3.Annotations.Add(new Annotation()
            {
                Content = FlowDiagram.CreateLabel(context, "Analyze process As-Is", (int)node3.Width, Color.White), HorizontalAlignment = HorizontalAlignment.Center
            });
            diagram.AddNode(node3);

            var node4 = DrawNode(280 * 2 * MainActivity.factor, node3.OffsetY + (140 * 2 * MainActivity.factor), 175 * 2 * MainActivity.factor, 70 * 2 * MainActivity.factor, ShapeType.RoundedRectangle);

            node4.Style.StrokeBrush = new SolidBrush(Color.Rgb(206, 98, 9));
            node4.Style.StrokeWidth = 0;
            node4.Annotations.Add(new Annotation()
            {
                Content = FlowDiagram.CreateLabel(context, "Identify" + "\n" + "opportunities" + "\n" + "for improvement", (int)node4.Width, Color.White), HorizontalAlignment = HorizontalAlignment.Center
            });
            diagram.AddNode(node4);

            var node5 = DrawNode(280 * 2 * MainActivity.factor, node4.OffsetY + (140 * 2 * MainActivity.factor), 175 * 2 * MainActivity.factor, 70 * 2 * MainActivity.factor, ShapeType.RoundedRectangle);

            node5.Style.StrokeBrush = new SolidBrush(Color.Rgb(206, 98, 9));
            node5.Style.StrokeWidth = 0;
            node5.Annotations.Add(new Annotation()
            {
                Content = FlowDiagram.CreateLabel(context, "Design and" + "\n" + "implement improved" + "\n" + "processess", (int)node5.Width, Color.White), HorizontalAlignment = HorizontalAlignment.Center
            });
            diagram.AddNode(node5);

            var node6 = DrawCustomShape(53 * 2, 155 * 2);

            node6.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0.5, IsVisible = false
            });
            diagram.AddNode(node6);
            var labelnode6 = new Node(context);

            labelnode6.OffsetX = 37.5f * 2 * MainActivity.factor;
            labelnode6.OffsetY = 200 * 2 * MainActivity.factor;
            labelnode6.Width   = 80 * 2 * MainActivity.factor;
            labelnode6.Height  = 35 * 2 * MainActivity.factor;
            labelnode6.Annotations.Add(new Annotation()
            {
                Content = "Sponsor", FontSize = 28 * MainActivity.factor, HorizontalAlignment = HorizontalAlignment.Center
            });
            labelnode6.Style = new Style()
            {
                StrokeBrush = new SolidBrush(Color.Transparent),
                Brush       = new SolidBrush(Color.Transparent)
            };
            diagram.AddNode(labelnode6);

            var node7 = DrawCustomShape(53 * 2, 497 * 2);

            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0, IsVisible = false
            });
            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0.3, IsVisible = false
            });
            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0.6, IsVisible = false
            });
            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 1, IsVisible = false
            });
            diagram.AddNode(node7);
            var labelnode7 = new Node(context);

            labelnode7.OffsetX = 55 * 2 * MainActivity.factor;
            labelnode7.OffsetY = 545 * 2 * MainActivity.factor;
            labelnode7.Width   = 60 * 2 * MainActivity.factor;
            labelnode7.Height  = 50 * 2 * MainActivity.factor;
            labelnode7.Annotations.Add(new Annotation()
            {
                Content = "Domain Experts", FontSize = 28 * MainActivity.factor, HorizontalAlignment = HorizontalAlignment.Center
            });
            labelnode7.Style = new Style()
            {
                StrokeBrush = new SolidBrush(Color.Transparent),
                Brush       = new SolidBrush(Color.Transparent)
            };
            diagram.AddNode(labelnode7);

            var node8 = DrawCustomShape(590 * 2, 155 * 2);

            node8.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0.5, IsVisible = false
            });
            diagram.AddNode(node8);
            var labelnode8 = new Node(context);

            labelnode8.OffsetX = 590.5f * 2 * MainActivity.factor;
            labelnode8.OffsetY = 200 * 2 * MainActivity.factor;
            labelnode8.Width   = 78 * 2 * MainActivity.factor;
            labelnode8.Height  = 49 * 2 * MainActivity.factor;
            labelnode8.Annotations.Add(new Annotation()
            {
                Content = "Project Manager", FontSize = 28 * MainActivity.factor, HorizontalAlignment = HorizontalAlignment.Center
            });
            labelnode8.Style = new Style()
            {
                StrokeBrush = new SolidBrush(Color.Transparent),
                Brush       = new SolidBrush(Color.Transparent)
            };
            diagram.AddNode(labelnode8);

            var node9 = DrawCustomShape(590 * 2, 497 * 2);

            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0, IsVisible = false
            });
            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0.3, IsVisible = false
            });
            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0.6, IsVisible = false
            });
            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 1, IsVisible = false
            });
            diagram.AddNode(node9);
            var labelnode9 = new Node(context);

            labelnode9.OffsetX = 591 * 2 * MainActivity.factor;
            labelnode9.OffsetY = 550 * 2 * MainActivity.factor;
            labelnode9.Width   = 65 * 2 * MainActivity.factor;
            labelnode9.Height  = 39 * 2 * MainActivity.factor;
            labelnode9.Annotations.Add(new Annotation()
            {
                Content = "Business Analyst", FontSize = 28 * MainActivity.factor, HorizontalAlignment = HorizontalAlignment.Center
            });
            labelnode9.Style = new Style()
            {
                StrokeBrush = new SolidBrush(Color.Transparent),
                Brush       = new SolidBrush(Color.Transparent)
            };
            diagram.AddNode(labelnode9);

            diagram.AddConnector(DrawConnector(node1, node2, node1.Ports[2], node2.Ports[0], SegmentType.OrthoSegment, Color.Rgb(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, Color.Rgb(127, 132, 133), Color.Rgb(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node2, node3, node2.Ports[2], node3.Ports[0], SegmentType.OrthoSegment, Color.Rgb(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, Color.Rgb(127, 132, 133), Color.Rgb(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node3, node4, node3.Ports[2], node4.Ports[0], SegmentType.OrthoSegment, Color.Rgb(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, Color.Rgb(127, 132, 133), Color.Rgb(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node4, node5, node4.Ports[2], node5.Ports[0], SegmentType.OrthoSegment, Color.Rgb(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, Color.Rgb(127, 132, 133), Color.Rgb(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node6, node1, node6.Ports[0], node1.Ports[3], SegmentType.OrthoSegment, Color.Rgb(127, 132, 133), StrokeStyle.Dashed, DecoratorType.Filled45Arrow, Color.Rgb(127, 132, 133), Color.Rgb(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node8, node1, node8.Ports[0], node1.Ports[1], SegmentType.OrthoSegment, Color.Rgb(127, 132, 133), StrokeStyle.Dashed, DecoratorType.Filled45Arrow, Color.Rgb(127, 132, 133), Color.Rgb(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node7, node2, node7.Ports[0], node2.Ports[3], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Square, Color.Black, Color.Black, 6));

            diagram.AddConnector(DrawConnector(node7, node3, node7.Ports[1], node3.Ports[3], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Square, Color.Black, Color.Black, 6));

            diagram.AddConnector(DrawConnector(node7, node4, node7.Ports[2], node4.Ports[3], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Square, Color.Black, Color.Black, 6));

            diagram.AddConnector(DrawConnector(node7, node5, node7.Ports[3], node5.Ports[3], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Square, Color.Black, Color.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node2, node9.Ports[0], node2.Ports[1], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Circle, Color.Black, Color.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node3, node9.Ports[1], node3.Ports[1], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Circle, Color.Black, Color.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node4, node9.Ports[2], node4.Ports[1], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Circle, Color.Black, Color.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node5, node9.Ports[3], node5.Ports[1], SegmentType.StraightSegment, Color.Black, StrokeStyle.Default, DecoratorType.Circle, Color.Black, Color.Black, 6));

            return(diagram);
        }
Exemple #3
0
        public override View GetSampleContent(Context context)
        {
            //Create SfDiagram.
            currentDensity = context.Resources.DisplayMetrics.Density;
            diagram        = new SfDiagram(context);
            diagram.ContextMenuSettings.Visibility = false;

            int width  = 150;
            int height = 75;

            width  = (int)(125 * MainActivity.Factor);
            height = (int)(60 * MainActivity.Factor);
            var node = AddNode(300, 400, width, height, "Goals");

            AddNodeStyle(node, GetColor("#d0ebff"), GetColor("#81bfea"));
            RootNode = node;
            diagram.AddNode(node);

            SColor.Add(GetColor("#d1afdf"));
            SColor.Add(GetColor("#90C8C2"));
            SColor.Add(GetColor("#8BC1B7"));
            SColor.Add(GetColor("#E2C180"));
            SColor.Add(GetColor("#BBBFD6"));
            SColor.Add(GetColor("#ACCBAA"));
            FColor.Add(GetColor("#e9d4f1"));
            FColor.Add(GetColor("#d4efed"));
            FColor.Add(GetColor("#c4f2e8"));
            FColor.Add(GetColor("#f7e0b3"));
            FColor.Add(GetColor("#DEE2FF"));
            FColor.Add(GetColor("#E5FEE4"));

            var ch1node = AddNode(100, 100, width, height, "Financial");

            index = rnd.Next(5);
            AddNodeStyle(ch1node, FColor[index], SColor[index]);
            diagram.AddNode(ch1node);

            var ch1childnode = AddNode(100, 100, width, height, "Investment");

            AddNodeStyle(ch1childnode, (ch1node.Style.Brush as SolidBrush).FillColor, (ch1node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch1childnode);

            var ch2node = AddNode(100, 600, width, height, "Social");

            index = rnd.Next(5);
            AddNodeStyle(ch2node, FColor[index], SColor[index]);
            diagram.AddNode(ch2node);

            var ch2childnode1 = AddNode(100, 100, width, height, "Friends");

            AddNodeStyle(ch2childnode1, (ch2node.Style.Brush as SolidBrush).FillColor, (ch2node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch2childnode1);

            var ch2childnode2 = AddNode(100, 100, width, height, "Family");

            AddNodeStyle(ch2childnode2, (ch2node.Style.Brush as SolidBrush).FillColor, (ch2node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch2childnode2);

            var ch3node = AddNode(500, 100, width, height, "Personal");

            index = rnd.Next(5);
            AddNodeStyle(ch3node, FColor[index], SColor[index]);
            diagram.AddNode(ch3node);

            var ch3childnode1 = AddNode(500, 100, width, height, "Sports");

            AddNodeStyle(ch3childnode1, (ch3node.Style.Brush as SolidBrush).FillColor, (ch3node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch3childnode1);

            var ch3childnode2 = AddNode(500, 100, width, height, "Food");

            AddNodeStyle(ch3childnode2, (ch3node.Style.Brush as SolidBrush).FillColor, (ch3node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch3childnode2);

            var ch4node = AddNode(500, 600, width, height, "Work");

            index = rnd.Next(5);
            AddNodeStyle(ch4node, FColor[index], SColor[index]);
            diagram.AddNode(ch4node);

            var ch4childnode1 = AddNode(500, 100, width, height, "Project");

            AddNodeStyle(ch4childnode1, (ch4node.Style.Brush as SolidBrush).FillColor, (ch4node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch4childnode1);

            var ch4childnode2 = AddNode(500, 100, width, height, "Career");

            AddNodeStyle(ch4childnode2, (ch4node.Style.Brush as SolidBrush).FillColor, (ch4node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch4childnode2);

            diagram.AddConnector(AddConnector(node, ch1node));
            diagram.AddConnector(AddConnector(node, ch2node));
            diagram.AddConnector(AddConnector(node, ch3node));
            diagram.AddConnector(AddConnector(node, ch4node));
            diagram.AddConnector(AddConnector(ch1node, ch1childnode));
            diagram.AddConnector(AddConnector(ch2node, ch2childnode1));
            diagram.AddConnector(AddConnector(ch2node, ch2childnode2));
            diagram.AddConnector(AddConnector(ch3node, ch3childnode1));
            diagram.AddConnector(AddConnector(ch3node, ch3childnode2));
            diagram.AddConnector(AddConnector(ch4node, ch4childnode1));
            diagram.AddConnector(AddConnector(ch4node, ch4childnode2));

            diagram.UserHandleClicked += Diagram_UserHandleClicked;
            AddHandles();
            diagram.NodeClicked += Diagram_NodeClicked;

            diagram.Clicked          += Diagram_Clicked;
            diagram.Loaded           += Diagram_Loaded;
            SelectedNode              = node;
            diagram.ConnectorClicked += Diagram_ConnectorClicked;
            return(diagram);
        }
Exemple #4
0
        public MindMap()
        {
            var width  = 150;
            var height = 75;

            path = "Images/Diagram/MindMapImages";
            var node = AddNode(300, 400, width, height, "Goals");

            AddNodeStyle(node, HexToRGB("#d0ebff"), HexToRGB("#81bfea"));
            RootNode = node;
            diagram.AddNode(node);

            SColor.Add(HexToRGB("#d1afdf"));
            SColor.Add(HexToRGB("#90C8C2"));
            SColor.Add(HexToRGB("#8BC1B7"));
            SColor.Add(HexToRGB("#E2C180"));
            SColor.Add(HexToRGB("#BBBFD6"));
            SColor.Add(HexToRGB("#ACCBAA"));
            FColor.Add(HexToRGB("#e9d4f1"));
            FColor.Add(HexToRGB("#d4efed"));
            FColor.Add(HexToRGB("#c4f2e8"));
            FColor.Add(HexToRGB("#f7e0b3"));
            FColor.Add(HexToRGB("#DEE2FF"));
            FColor.Add(HexToRGB("#E5FEE4"));

            var ch1node = AddNode(100, 100, width, height, "Financial");

            index = rnd.Next(5);
            AddNodeStyle(ch1node, FColor[index], SColor[index]);
            diagram.AddNode(ch1node);

            var ch1childnode = AddNode(100, 100, width, height, "Investment");

            AddNodeStyle(ch1childnode, (ch1node.Style.Brush as SolidBrush).FillColor, (ch1node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch1childnode);

            var ch2node = AddNode(100, 600, width, height, "Social");

            index = rnd.Next(5);
            AddNodeStyle(ch2node, FColor[index], SColor[index]);
            diagram.AddNode(ch2node);

            var ch2childnode1 = AddNode(100, 100, width, height, "Friends");

            AddNodeStyle(ch2childnode1, (ch2node.Style.Brush as SolidBrush).FillColor, (ch2node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch2childnode1);

            var ch2childnode2 = AddNode(100, 100, width, height, "Family");

            AddNodeStyle(ch2childnode2, (ch2node.Style.Brush as SolidBrush).FillColor, (ch2node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch2childnode2);

            var ch3node = AddNode(500, 100, width, height, "Personal");

            index = rnd.Next(5);
            AddNodeStyle(ch3node, FColor[index], SColor[index]);
            diagram.AddNode(ch3node);

            var ch3childnode1 = AddNode(500, 100, width, height, "Sports");

            AddNodeStyle(ch3childnode1, (ch3node.Style.Brush as SolidBrush).FillColor, (ch3node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch3childnode1);

            var ch3childnode2 = AddNode(500, 100, width, height, "Food");

            AddNodeStyle(ch3childnode2, (ch3node.Style.Brush as SolidBrush).FillColor, (ch3node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch3childnode2);

            var ch4node = AddNode(500, 600, width, height, "Work");

            index = rnd.Next(5);
            AddNodeStyle(ch4node, FColor[index], SColor[index]);
            diagram.AddNode(ch4node);

            var ch4childnode1 = AddNode(500, 100, width, height, "Project");

            AddNodeStyle(ch4childnode1, (ch4node.Style.Brush as SolidBrush).FillColor, (ch4node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch4childnode1);

            var ch4childnode2 = AddNode(500, 100, width, height, "Career");

            AddNodeStyle(ch4childnode2, (ch4node.Style.Brush as SolidBrush).FillColor, (ch4node.Style.StrokeBrush as SolidBrush).FillColor);
            diagram.AddNode(ch4childnode2);

            diagram.AddConnector(AddConnector(node, ch1node));
            diagram.AddConnector(AddConnector(node, ch2node));
            diagram.AddConnector(AddConnector(node, ch3node));
            diagram.AddConnector(AddConnector(node, ch4node));
            diagram.AddConnector(AddConnector(ch1node, ch1childnode));
            diagram.AddConnector(AddConnector(ch2node, ch2childnode1));
            diagram.AddConnector(AddConnector(ch2node, ch2childnode2));
            diagram.AddConnector(AddConnector(ch3node, ch3childnode1));
            diagram.AddConnector(AddConnector(ch3node, ch3childnode2));
            diagram.AddConnector(AddConnector(ch4node, ch4childnode1));
            diagram.AddConnector(AddConnector(ch4node, ch4childnode2));

            diagram.UserHandleClicked += Diagram_UserHandleClicked;
            AddHandles();
            diagram.NodeClicked += Diagram_NodeClicked;

            diagram.Clicked          += Diagram_DiagramClicked;
            diagram.Loaded           += Diagram_Loaded;
            SelectedNode              = node;
            diagram.TextChanged      += Diagram_TextChanged;
            diagram.ConnectorClicked += Diagram_ConnectorClicked;
            this.AddSubview(diagram);
        }
Exemple #5
0
        public FlowDiagram()
        {
            diagram = new SfDiagram();

            selectionPicker1 = new UIPickerView();
            this.OptionView  = new UIView();
            Node n1 = DrawNode(100, 30, 160, 55, ShapeType.RoundedRectangle, "New idea identified", 30, UIColor.FromRGB(49, 162, 255), UIColor.FromRGB(23, 132, 206));

            diagram.AddNode(n1);

            Node n2 = DrawNode(100, 130, 160, 55, ShapeType.RoundedRectangle, "Meeting With Board", 4, UIColor.FromRGB(49, 162, 255), UIColor.FromRGB(23, 132, 206));

            diagram.AddNode(n2);

            Node n3 = DrawNode(105, 230, 150, 150, ShapeType.Diamond, "Board decides \n whether to \n proceed ", 0, UIColor.FromRGB(0, 194, 192), UIColor.FromRGB(4, 142, 135));

            diagram.AddNode(n3);

            Node n4 = DrawNode(105, 425, 150, 150, ShapeType.Diamond, "Find Project  \n Manager, write \n specification", 0, UIColor.FromRGB(0, 194, 192), UIColor.FromRGB(4, 142, 135));

            diagram.AddNode(n4);

            Node n5 = DrawNode(90, 620, 180, 60, ShapeType.RoundedRectangle, "Implement and deliver", 30, UIColor.FromRGB(49, 162, 255), UIColor.FromRGB(23, 132, 206));

            diagram.AddNode(n5);

            Node n6 = DrawNode(320, 275, 200, 60, ShapeType.RoundedRectangle, "Reject and report the reason", 4, UIColor.FromRGB(239, 75, 93), UIColor.FromRGB(201, 32, 61));

            diagram.AddNode(n6);

            Node n7 = DrawNode(320, 470, 200, 60, ShapeType.RoundedRectangle, "Hire new resources", 4, UIColor.FromRGB(239, 75, 93), UIColor.FromRGB(201, 32, 61));

            diagram.AddNode(n7);

            //Create Connector
            Connector c1 = new Connector(n1, n2);

            diagram.AddConnector(c1);

            Connector c2 = new Connector(n2, n3);

            diagram.AddConnector(c2);

            Connector c3 = new Connector(n3, n4);

            c3.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("Yes", -25, 10, 25, 20)
            });
            diagram.AddConnector(c3);

            Connector c4 = new Connector(n4, n5);

            c4.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("Yes", -25, 10, 25, 20)
            });
            diagram.AddConnector(c4);

            Connector c5 = new Connector(n3, n6);

            c5.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("No", 15, 15, 25, 20)
            });
            diagram.AddConnector(c5);

            Connector c6 = new Connector(n4, n7);

            c6.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("No", 15, 15, 25, 20)
            });
            diagram.AddConnector(c6);

            for (int i = 0; i < diagram.Connectors.Count; i++)
            {
                diagram.Connectors[i].Style.StrokeBrush                = new SolidBrush(UIColor.FromRGB(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.Fill        = (UIColor.FromRGB(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.StrokeColor = (UIColor.FromRGB(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.StrokeWidth = 1;
                diagram.Connectors[i].Style.StrokeWidth                = 1;
            }
            diagram.EnableTextEditing      = false;
            diagram.PageSettings.GridSize  = 12;
            diagram.PageSettings.GridColor = UIColor.FromRGB(230, 230, 230);
            this.AddSubview(diagram);

            gridColor                 = new UILabel();
            gridColor.Text            = "Grid Color";
            gridColor.TextColor       = UIColor.Black;
            gridColor.TextAlignment   = UITextAlignment.Left;
            gridColor.BackgroundColor = UIColor.Clear;

            colorView.BackgroundColor = UIColor.Clear;
            colorView.ScrollEnabled   = true;
            colorView.ShowsHorizontalScrollIndicator = true;
            colorView.ShowsVerticalScrollIndicator   = false;

            int x = 50;

            colorView.AddSubview(AddColorButton(10, UIColor.Red));
            colorView.AddSubview(AddColorButton((x * 1), UIColor.Orange));
            colorView.AddSubview(AddColorButton((x * 2), UIColor.FromRGB(0, 128, 0)));
            colorView.AddSubview(AddColorButton((x * 3), UIColor.Blue));
            colorView.AddSubview(AddColorButton((x * 4), UIColor.Purple));
            colorView.AddSubview(AddColorButton((x * 5), UIColor.FromRGB(51, 255, 255)));
            colorView.AddSubview(AddColorButton((x * 6), UIColor.FromRGB(255, 0, 255)));
            colorView.AddSubview(AddColorButton((x * 7), UIColor.Gray));
            colorView.AddSubview(AddColorButton((x * 8), UIColor.FromRGB(0, 255, 0)));
            colorView.AddSubview(AddColorButton((x * 9), UIColor.FromRGB(128, 0, 0)));
            colorView.AddSubview(AddColorButton((x * 10), UIColor.FromRGB(0, 0, 128)));
            colorView.AddSubview(AddColorButton((x * 11), UIColor.FromRGB(128, 128, 0)));
            colorView.AddSubview(AddColorButton((x * 12), UIColor.FromRGB(192, 192, 192)));
            colorView.AddSubview(AddColorButton((x * 13), UIColor.FromRGB(0, 128, 128)));
            colorView.ContentSize      = new CGSize(850, colorView.ContentSize.Height);
            enablegrid                 = new UILabel();
            enablegrid.Text            = "Show Grid";
            enablegrid.TextColor       = UIColor.Black;
            enablegrid.TextAlignment   = UITextAlignment.Left;
            enablegrid.BackgroundColor = UIColor.Clear;

            enablegrid                 = new UILabel();
            enablegrid.Text            = "Show Grid";
            enablegrid.TextColor       = UIColor.Black;
            enablegrid.TextAlignment   = UITextAlignment.Left;
            enablegrid.BackgroundColor = UIColor.Clear;

            gridswitch = new UISwitch();
            gridswitch.TouchUpInside  += Gridswitch_TouchUpInside;
            gridswitch.BackgroundColor = UIColor.Clear;

            snapgrid                 = new UILabel();
            snapgrid.Text            = "Snap To Grid";
            snapgrid.TextColor       = UIColor.Black;
            snapgrid.TextAlignment   = UITextAlignment.Left;
            snapgrid.BackgroundColor = UIColor.Clear;

            snapgridswitch = new UISwitch();
            snapgridswitch.TouchUpInside  += Snapgridswitch_TouchUpInside;
            snapgridswitch.BackgroundColor = UIColor.Clear;
            snapgridswitch.Enabled         = false;

            gridSize               = new UILabel();
            gridSize.Text          = "Size";
            gridSize.TextColor     = UIColor.Black;
            gridSize.TextAlignment = UITextAlignment.Left;

            plus = new UIButton();
            plus.BackgroundColor    = UIColor.White;
            plus.Layer.CornerRadius = 8;
            plus.Layer.BorderWidth  = 0.5f;
            plus.TouchUpInside     += Plus_TouchUpInside;
            plusimg       = new UIImageView();
            plusimg.Image = UIImage.FromBundle("Images/Diagram/CSplus.png");
            plus.AddSubview(plusimg);

            minus = new UIButton();
            minus.BackgroundColor    = UIColor.White;
            minus.Layer.CornerRadius = 8;
            minus.Layer.BorderWidth  = 0.5f;
            minus.TouchUpInside     += Minus_TouchUpInside;
            minusimg       = new UIImageView();
            minusimg.Image = UIImage.FromBundle("Images/Diagram/CSsub.png");
            minus.AddSubview(minusimg);

            sizeindicator                 = new UILabel();
            sizeindicator.Text            = width.ToString();
            sizeindicator.BackgroundColor = UIColor.Clear;
            sizeindicator.TextColor       = UIColor.Black;
            sizeindicator.TextAlignment   = UITextAlignment.Center;
            optionView();


            gridColor.Frame       = new CGRect(this.Frame.X + 10, 20, 100, 30);
            colorView.Frame       = new CGRect(this.Frame.X + 10, 60, 300, 45);
            colorView.ContentSize = new CGSize(850, colorView.ContentSize.Height);
            enablegrid.Frame      = new CGRect(this.Frame.X + 10, 120, 100, 30);
            gridswitch.Frame      = new CGRect(this.Frame.X + 250, 120, 40, 30);
            snapgrid.Frame        = new CGRect(this.Frame.X + 10, 170, 100, 30);
            snapgridswitch.Frame  = new CGRect(this.Frame.X + 250, 170, 40, 30);
            gridSize.Frame        = new CGRect(this.Frame.X + 10, 220, PopoverSize.Width - 20, 30);
            plus.Frame            = new CGRect(this.Frame.X + 160, 270, 30, 30);
            plusimg.Frame         = new CGRect(0, 0, 30, 30);
            minus.Frame           = new CGRect(this.Frame.X + 60, 270, 30, 30);
            minusimg.Frame        = new CGRect(0, 0, 30, 30);
            sizeindicator.Frame   = new CGRect(this.Frame.X + 110, 270, 30, 30);

            diagram.ConnectorClicked += Diagram_ConnectorClicked;
            diagram.ContextMenuSettings.Visibility = false;
        }
        public override View GetSampleContent(Context context)
        {
            currentDensity = context.Resources.DisplayMetrics.Density;
            //Initialize the SfDiagram instance and set background.
            diagram = new SfDiagram(context);
            diagram.ContextMenuSettings.Visibility = false;
            diagram.BackgroundColor   = Color.White;
            diagram.EnableTextEditing = false;
            //Create nodes and set the offset, size and other properties.
            Node n1 = new Node(context);

            n1.ShapeType         = ShapeType.RoundedRectangle;
            n1.CornerRadius      = 90 * MainActivity.Factor;
            n1.OffsetX           = 185 * MainActivity.Factor;
            n1.OffsetY           = 80 * MainActivity.Factor;
            n1.Width             = 320 * MainActivity.Factor;
            n1.Height            = 110 * MainActivity.Factor;
            n1.Style.Brush       = new SolidBrush(Color.Rgb(49, 162, 255));
            n1.Style.StrokeBrush = new SolidBrush(Color.Rgb(23, 132, 206));
            TextView content1 = CreateLabel(context, "New idea identified", (int)n1.Width, Color.Rgb(255, 255, 255));

            n1.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content1
            });
            diagram.AddNode(n1);

            Node n2 = new Node(context);

            n2.OffsetX           = 185 * MainActivity.Factor;
            n2.OffsetY           = 280 * MainActivity.Factor;
            n2.Width             = 320 * MainActivity.Factor;
            n2.Height            = 110 * MainActivity.Factor;
            n2.ShapeType         = ShapeType.RoundedRectangle;
            n2.CornerRadius      = 15 * MainActivity.Factor;
            n2.Style.Brush       = new SolidBrush(Color.Rgb(49, 162, 255));
            n2.Style.StrokeBrush = new SolidBrush(Color.Rgb(23, 132, 206));
            TextView content2 = CreateLabel(context, "Meeting With Boards", (int)n2.Width, Color.Rgb(255, 255, 255));

            n2.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content2
            });
            diagram.AddNode(n2);

            Node n3 = new Node(context);

            n3.ShapeType         = ShapeType.Diamond;
            n3.OffsetX           = 195 * MainActivity.Factor;
            n3.OffsetY           = 480 * MainActivity.Factor;
            n3.Width             = 300 * MainActivity.Factor;
            n3.Height            = 300 * MainActivity.Factor;
            n3.Style.Brush       = new SolidBrush(Color.Rgb(0, 194, 192));
            n3.Style.StrokeBrush = new SolidBrush(Color.Rgb(4, 142, 135));
            TextView content3 = CreateLabel(context, "Board decides" + "\n" + "whether to" + "\n" + "proceed", (int)n3.Width, Color.Rgb(255, 255, 255));

            n3.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content3
            });
            diagram.AddNode(n3);

            Node n4 = new Node(context);

            n4.ShapeType         = ShapeType.Diamond;
            n4.OffsetX           = 195 * MainActivity.Factor;
            n4.OffsetY           = 870 * MainActivity.Factor;
            n4.Width             = 300 * MainActivity.Factor;
            n4.Height            = 300 * MainActivity.Factor;
            n4.Style.Brush       = new SolidBrush(Color.Rgb(0, 194, 192));
            n4.Style.StrokeBrush = new SolidBrush(Color.Rgb(4, 142, 135));
            TextView content4 = CreateLabel(context, "Find Project" + "\n" + "Manager, write" + "\n" + "specification", (int)n4.Width, Color.Rgb(255, 255, 255));

            n4.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content4
            });
            diagram.AddNode(n4);

            Node n5 = new Node(context);

            n5.Style.Brush       = new SolidBrush(Color.Rgb(49, 162, 255));
            n5.Style.StrokeBrush = new SolidBrush(Color.Rgb(23, 132, 206));
            n5.OffsetX           = 185 * MainActivity.Factor;
            n5.OffsetY           = 1260 * MainActivity.Factor;
            n5.Width             = 320 * MainActivity.Factor;
            n5.Height            = 110 * MainActivity.Factor;
            n5.ShapeType         = ShapeType.RoundedRectangle;
            n5.CornerRadius      = 90 * MainActivity.Factor;
            TextView content5 = CreateLabel(context, "Implement and deliver", (int)n5.Width, Color.Rgb(255, 255, 255));

            n5.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content5
            });
            diagram.AddNode(n5);

            Node n6 = new Node(context);

            n6.Style.Brush       = new SolidBrush(Color.Rgb(239, 75, 93));
            n6.Style.StrokeBrush = new SolidBrush(Color.Rgb(201, 32, 61));
            n6.OffsetX           = 674 * MainActivity.Factor;
            n6.OffsetY           = 575 * MainActivity.Factor;
            n6.Width             = 320 * MainActivity.Factor;
            n6.Height            = 110 * MainActivity.Factor;
            n6.ShapeType         = ShapeType.RoundedRectangle;
            n6.CornerRadius      = 15 * MainActivity.Factor;
            TextView content6 = CreateLabel(context, "Reject and report the reason", (int)n6.Width, Color.Rgb(255, 255, 255));

            n6.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content6
            });
            diagram.AddNode(n6);

            Node n7 = new Node(context);

            n7.Style.Brush       = new SolidBrush(Color.Rgb(239, 75, 93));
            n7.Style.StrokeBrush = new SolidBrush(Color.Rgb(201, 32, 61));
            n7.OffsetX           = 674 * MainActivity.Factor;
            n7.OffsetY           = 965.599f * MainActivity.Factor;
            n7.Width             = 320 * MainActivity.Factor;
            n7.Height            = 110 * MainActivity.Factor;
            n7.ShapeType         = ShapeType.RoundedRectangle;
            n7.CornerRadius      = 15 * MainActivity.Factor;
            TextView content7 = CreateLabel(context, "Hire new resources", (int)n7.Width, Color.Rgb(255, 255, 255));

            n7.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content7
            });
            diagram.AddNode(n7);

            //Create connector with its source and target node.
            Connector c1 = new Connector(context, n1, n2);

            diagram.AddConnector(c1);

            Connector c2 = new Connector(context, n2, n3);

            diagram.AddConnector(c2);

            Connector c3 = new Connector(context, n3, n4);

            //Create label for the connector.
            c3.Annotations.Add(new Annotation()
            {
                Content = "Yes", HorizontalAlignment = HorizontalAlignment.Left, FontSize = 20 * MainActivity.Factor, TextBrush = new SolidBrush(Color.Rgb(127, 132, 133))
            });
            diagram.AddConnector(c3);

            Connector c4 = new Connector(context, n4, n5);

            c4.Annotations.Add(new Annotation()
            {
                Content = "Yes", HorizontalAlignment = HorizontalAlignment.Left, FontSize = 20 * MainActivity.Factor, TextBrush = new SolidBrush(Color.Rgb(127, 132, 133))
            });
            diagram.AddConnector(c4);
            diagram.IsReadOnly = false;
            Connector c5 = new Connector(context, n3, n6);

            c5.Annotations.Add(new Annotation()
            {
                Content = "No", FontSize = 20 * MainActivity.Factor, TextBrush = new SolidBrush(Color.Rgb(127, 132, 133))
            });
            diagram.AddConnector(c5);

            Connector c6 = new Connector(context, n4, n7);

            c6.Annotations.Add(new Annotation()
            {
                Content = "No", FontSize = 20 * MainActivity.Factor, TextBrush = new SolidBrush(Color.Rgb(127, 132, 133))
            });
            diagram.AddConnector(c6);

            //Set the stroke color for the connector.
            for (int i = 0; i < diagram.Connectors.Count; i++)
            {
                //Diagram.Connectors[i].TargetDecoratorType = DecoratorType.None;
                diagram.Connectors[i].Style.StrokeBrush                = new SolidBrush(Color.Rgb(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.Fill        = (Color.Rgb(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.StrokeColor = (Color.Rgb(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.StrokeWidth = 4 * MainActivity.Factor;
                diagram.Connectors[i].TargetDecoratorStyle.Size        = 14 * MainActivity.Factor;
                diagram.Connectors[i].Style.StrokeWidth                = 2 * MainActivity.Factor;
            }
            //Set the stroke size for node.
            for (int i = 0; i < diagram.Nodes.Count; i++)
            {
                diagram.Nodes[i].Style.StrokeWidth = 1;
            }
            diagram.Loaded                += Diagram_Loaded;
            diagram.ConnectorClicked      += Diagram_ConnectorClicked;
            diagram.PageSettings.GridSize  = 12 * currentDensity;
            diagram.PageSettings.GridColor = Color.Rgb(230, 230, 230);
            return(diagram);
        }
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            //Set diagram width and height
            diagram.Width           = (float)Frame.Width;
            diagram.Height          = (float)Frame.Height;
            diagram.EnableSelectors = false;

            //Create Node
            Node n1 = DrawNode(100, 30, 160, 55, ShapeType.RoundedRectangle, "New idea identified", 30, UIColor.FromRGB(49, 162, 255), UIColor.FromRGB(23, 132, 206));

            diagram.AddNode(n1);

            Node n2 = DrawNode(100, 130, 160, 55, ShapeType.RoundedRectangle, "Meeting With Board", 4, UIColor.FromRGB(49, 162, 255), UIColor.FromRGB(23, 132, 206));

            diagram.AddNode(n2);

            Node n3 = DrawNode(105, 230, 150, 150, ShapeType.Diamond, "Board decides \n whether to \n proceed ", 0, UIColor.FromRGB(0, 194, 192), UIColor.FromRGB(4, 142, 135));

            diagram.AddNode(n3);

            Node n4 = DrawNode(105, 425, 150, 150, ShapeType.Diamond, "Find Project  \n Manager, write \n specification", 0, UIColor.FromRGB(0, 194, 192), UIColor.FromRGB(4, 142, 135));

            diagram.AddNode(n4);

            Node n5 = DrawNode(90, 620, 180, 60, ShapeType.RoundedRectangle, "Implement and deliver", 30, UIColor.FromRGB(49, 162, 255), UIColor.FromRGB(23, 132, 206));

            diagram.AddNode(n5);

            Node n6 = DrawNode(320, 275, 200, 60, ShapeType.RoundedRectangle, "Reject and report the reason", 4, UIColor.FromRGB(239, 75, 93), UIColor.FromRGB(201, 32, 61));

            diagram.AddNode(n6);

            Node n7 = DrawNode(320, 470, 200, 60, ShapeType.RoundedRectangle, "Hire new resources", 4, UIColor.FromRGB(239, 75, 93), UIColor.FromRGB(201, 32, 61));

            diagram.AddNode(n7);

            //Create Connector
            Connector c1 = new Connector(n1, n2);

            diagram.AddConnector(c1);

            Connector c2 = new Connector(n2, n3);

            diagram.AddConnector(c2);

            Connector c3 = new Connector(n3, n4);

            c3.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("Yes", -25, 10, 25, 20)
            });
            diagram.AddConnector(c3);

            Connector c4 = new Connector(n4, n5);

            c4.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("Yes", -25, 10, 25, 20)
            });
            diagram.AddConnector(c4);

            Connector c5 = new Connector(n3, n6);

            c5.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("No", 15, 15, 25, 20)
            });
            diagram.AddConnector(c5);

            Connector c6 = new Connector(n4, n7);

            c6.Annotations.Add(new Annotation()
            {
                Content = CreateConnectorLabel("No", 15, 15, 25, 20)
            });
            diagram.AddConnector(c6);

            for (int i = 0; i < diagram.Connectors.Count; i++)
            {
                diagram.Connectors[i].Style.StrokeBrush                = new SolidBrush(UIColor.FromRGB(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.Fill        = (UIColor.FromRGB(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.StrokeColor = (UIColor.FromRGB(127, 132, 133));
                diagram.Connectors[i].TargetDecoratorStyle.StrokeWidth = 1;
                diagram.Connectors[i].Style.StrokeWidth                = 1;
            }

            this.AddSubview(diagram);
        }
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();
            //Set diagram width and height
            diagram.Width           = (float)Frame.Width;
            diagram.Height          = (float)Frame.Height;
            diagram.EnableSelectors = false;

            var node1 = DrawNode(((float)(280)), 150, 155, 50, ShapeType.RoundedRectangle);

            node1.Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(206, 98, 9));
            node1.Annotations.Add(new Annotation()
            {
                Content = CreateLabel("Establish Project and Team", 12)
            });
            diagram.AddNode(node1);

            var node2 = DrawNode(((float)(280)), (float)(node1.OffsetY + 90), 155, 50, ShapeType.RoundedRectangle);

            node2.Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(206, 98, 9));
            node2.Style.Brush       = new LinearGradientBrush(0, 30, 150, 30, new UIColor[] { UIColor.FromRGB(255, 130, 0), UIColor.FromRGB(255, 37, 0) }, GradientDrawingOptions.DrawsAfterEndLocation);
            node2.Style.StrokeWidth = 0;
            node2.Annotations.Add(new Annotation()
            {
                Content = CreateLabel("Define Scope", 12)
            });
            diagram.AddNode(node2);

            var node3 = DrawNode(((float)(280)), (float)(node2.OffsetY + 90), 155, 50, ShapeType.RoundedRectangle);

            node3.Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(206, 98, 9));
            node3.Style.StrokeStyle = StrokeStyle.Dashed;
            node3.Annotations.Add(new Annotation()
            {
                Content = CreateLabel("Analyze process As-Is", 12)
            });
            diagram.AddNode(node3);

            var node4 = DrawNode(((float)(280)), (float)(node3.OffsetY + 90), 155, 50, ShapeType.RoundedRectangle);

            node4.Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(206, 98, 9));
            node4.Style.StrokeWidth = 0;
            node4.Annotations.Add(new Annotation()
            {
                Content = CreateLabel("Identify opportunities for improvement", 12)
            });
            diagram.AddNode(node4);

            var node5 = DrawNode(((float)(280)), (float)(node4.OffsetY + 90), 155, 50, ShapeType.RoundedRectangle);

            node5.Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(206, 98, 9));
            node5.Style.StrokeWidth = 0;
            node5.Annotations.Add(new Annotation()
            {
                Content = CreateLabel("Design and implement improved processess", 12)
            });
            diagram.AddNode(node5);

            var node6 = DrawCustomShape(53, 155);

            node6.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0.5, IsVisible = false
            });
            diagram.AddNode(node6);
            var labelnode6 = new Node(33.5f, 195, 80, 35);

            labelnode6.Annotations.Add(new Annotation()
            {
                Content = "Sponsor", FontSize = 10,
            });
            labelnode6.Style = new Style()
            {
                StrokeBrush = new SolidBrush(UIColor.Clear),
                Brush       = new SolidBrush(UIColor.Clear)
            };
            diagram.AddNode(labelnode6);

            var node7 = DrawCustomShape(53, 347);

            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0, IsVisible = false
            });
            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0.3, IsVisible = false
            });
            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 0.6, IsVisible = false
            });
            node7.Ports.Add(new Port()
            {
                NodeOffsetX = 1, NodeOffsetY = 1, IsVisible = false
            });
            diagram.AddNode(node7);
            var labelnode7 = new Node(55, 393, 60, 50);

            labelnode7.Annotations.Add(new Annotation()
            {
                Content = "Domain Experts", FontSize = 10,
            });
            labelnode7.Style = new Style()
            {
                StrokeBrush = new SolidBrush(UIColor.Clear),
                Brush       = new SolidBrush(UIColor.Clear)
            };
            diagram.AddNode(labelnode7);

            var node8 = DrawCustomShape(590, 155);

            node8.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0.5, IsVisible = false
            });
            diagram.AddNode(node8);
            var labelnode8 = new Node(590.5f, 200, 78, 49);

            labelnode8.Annotations.Add(new Annotation()
            {
                Content = "Project Manager", FontSize = 10,
            });
            labelnode8.Style = new Style()
            {
                StrokeBrush = new SolidBrush(UIColor.Clear),
                Brush       = new SolidBrush(UIColor.Clear)
            };
            diagram.AddNode(labelnode8);

            var node9 = DrawCustomShape(590, 347);

            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0, IsVisible = false
            });
            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0.3, IsVisible = false
            });
            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 0.6, IsVisible = false
            });
            node9.Ports.Add(new Port()
            {
                NodeOffsetX = 0, NodeOffsetY = 1, IsVisible = false
            });
            diagram.AddNode(node9);
            var labelnode9 = new Node(591, 398.5f, 65, 39);

            labelnode9.Annotations.Add(new Annotation()
            {
                Content = "Business Analyst", FontSize = 10,
            });
            labelnode9.Style = new Style()
            {
                StrokeBrush = new SolidBrush(UIColor.Clear),
                Brush       = new SolidBrush(UIColor.Clear)
            };
            diagram.AddNode(labelnode9);

            diagram.AddConnector(DrawConnector(node1, node2, node1.Ports[2], node2.Ports[0], SegmentType.OrthoSegment, UIColor.FromRGB(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, UIColor.FromRGB(127, 132, 133), UIColor.FromRGB(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node2, node3, node2.Ports[2], node3.Ports[0], SegmentType.OrthoSegment, UIColor.FromRGB(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, UIColor.FromRGB(127, 132, 133), UIColor.FromRGB(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node3, node4, node3.Ports[2], node4.Ports[0], SegmentType.OrthoSegment, UIColor.FromRGB(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, UIColor.FromRGB(127, 132, 133), UIColor.FromRGB(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node4, node5, node4.Ports[2], node5.Ports[0], SegmentType.OrthoSegment, UIColor.FromRGB(127, 132, 133), StrokeStyle.Default, DecoratorType.Filled45Arrow, UIColor.FromRGB(127, 132, 133), UIColor.FromRGB(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node6, node1, node6.Ports[0], node1.Ports[3], SegmentType.OrthoSegment, UIColor.FromRGB(127, 132, 133), StrokeStyle.Dashed, DecoratorType.Filled45Arrow, UIColor.FromRGB(127, 132, 133), UIColor.FromRGB(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node8, node1, node8.Ports[0], node1.Ports[1], SegmentType.OrthoSegment, UIColor.FromRGB(127, 132, 133), StrokeStyle.Dashed, DecoratorType.Filled45Arrow, UIColor.FromRGB(127, 132, 133), UIColor.FromRGB(127, 132, 133), 8));

            diagram.AddConnector(DrawConnector(node7, node2, node7.Ports[0], node2.Ports[3], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Square, UIColor.Black, UIColor.Black, 6));

            diagram.AddConnector(DrawConnector(node7, node3, node7.Ports[1], node3.Ports[3], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Square, UIColor.Black, UIColor.Black, 6));

            diagram.AddConnector(DrawConnector(node7, node4, node7.Ports[2], node4.Ports[3], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Square, UIColor.Black, UIColor.Black, 6));

            diagram.AddConnector(DrawConnector(node7, node5, node7.Ports[3], node5.Ports[3], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Square, UIColor.Black, UIColor.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node2, node9.Ports[0], node2.Ports[1], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Circle, UIColor.Black, UIColor.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node3, node9.Ports[1], node3.Ports[1], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Circle, UIColor.Black, UIColor.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node4, node9.Ports[2], node4.Ports[1], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Circle, UIColor.Black, UIColor.Black, 6));

            diagram.AddConnector(DrawConnector(node9, node5, node9.Ports[3], node5.Ports[1], SegmentType.StraightSegment, UIColor.Black, StrokeStyle.Default, DecoratorType.Circle, UIColor.Black, UIColor.Black, 6));

            this.AddSubview(diagram);
        }
Exemple #9
0
        public Connectors()
        {
            HeaderBar.BackgroundColor = UIColor.FromRGB(245, 245, 245);
            var label = new UILabel();

            label.Text            = "Connector Types: ";
            label.TextColor       = UIColor.Black;
            label.BackgroundColor = UIColor.Clear;
            label.TextAlignment   = UITextAlignment.Center;
            label.Frame           = new CGRect(20, 0, 180, 60);
            HeaderBar.AddSubview(label);

            straight = AddButton(220, "Images/Diagram/CSStraight.png");
            straight.TouchUpInside += Straight_TouchUpInside;
            HeaderBar.AddSubview(straight);

            curve = AddButton(280, "Images/Diagram/CSCurve.png");
            curve.TouchUpInside += Curve_TouchUpInside;;
            HeaderBar.AddSubview(curve);

            ortho = AddButton(340, "Images/Diagram/CSOrtho.png");
            ortho.TouchUpInside  += Ortho_TouchUpInside;
            ortho.BackgroundColor = UIColor.FromRGB(30, 144, 255);
            HeaderBar.AddSubview(ortho);

            selectionPicker1 = new UIPickerView();
            this.OptionView  = new UIView();

            PickerModel model = new PickerModel(verticalOrientationlist);

            selectionPicker1.Model = model;

            connectorStyle               = new UILabel();
            connectorStyle.Text          = "Connector Style";
            connectorStyle.TextColor     = UIColor.Black;
            connectorStyle.TextAlignment = UITextAlignment.Left;

            connectorSize               = new UILabel();
            connectorSize.Text          = "Connector Size";
            connectorSize.TextColor     = UIColor.Black;
            connectorSize.TextAlignment = UITextAlignment.Left;

            //Represent the vertical button
            connectorStyleButton = new UIButton();
            connectorStyleButton.SetTitle("Default", UIControlState.Normal);
            connectorStyleButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            connectorStyleButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            connectorStyleButton.Layer.CornerRadius  = 8;
            connectorStyleButton.Layer.BorderWidth   = 2;
            connectorStyleButton.TouchUpInside      += ShowPicker1;
            connectorStyleButton.BackgroundColor     = UIColor.LightGray;
            connectorStyleButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            plus = new UIButton();
            plus.BackgroundColor    = UIColor.White;
            plus.Layer.CornerRadius = 8;
            plus.Layer.BorderWidth  = 0.5f;
            plus.TouchUpInside     += Plus_TouchUpInside;
            plusimg       = new UIImageView();
            plusimg.Image = UIImage.FromBundle("Images/Diagram/CSplus.png");
            plus.AddSubview(plusimg);

            minus = new UIButton();
            minus.BackgroundColor    = UIColor.White;
            minus.Layer.CornerRadius = 8;
            minus.Layer.BorderWidth  = 0.5f;
            minus.TouchUpInside     += Minus_TouchUpInside;
            minusimg       = new UIImageView();
            minusimg.Image = UIImage.FromBundle("Images/Diagram/CSsub.png");
            minus.AddSubview(minusimg);

            sizeindicator                 = new UILabel();
            sizeindicator.Text            = width.ToString();
            sizeindicator.BackgroundColor = UIColor.Clear;
            sizeindicator.TextColor       = UIColor.Black;
            sizeindicator.TextAlignment   = UITextAlignment.Center;

            //Represent the button
            doneButton.SetTitle("Done\t", UIControlState.Normal);
            doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            doneButton.TouchUpInside      += HidePicker;
            doneButton.Hidden          = true;
            doneButton.BackgroundColor = UIColor.FromRGB(246, 246, 246);
            selectionPicker1.ShowSelectionIndicator = true;
            selectionPicker1.Hidden = true;

            Node node1  = new Node();
            Node node2  = new Node();
            Node node3  = new Node();
            Node node4  = new Node();
            Node node5  = new Node();
            Node node6  = new Node();
            Node node7  = new Node();
            Node node8  = new Node();
            Node node9  = new Node();
            Node node10 = new Node();
            Node node11 = new Node();

            diagram.IsReadOnly = true;

            node1  = AddNode(456, 180, "CEO", UIColor.FromRGB(201, 32, 61));
            node2  = AddNode(286, 396, "Manager", UIColor.FromRGB(23, 132, 206));
            node3  = AddNode(646, 396, "Manager", UIColor.FromRGB(23, 132, 206));
            node4  = AddNode(204, 612, "Team Lead", UIColor.FromRGB(4, 142, 135));
            node5  = AddNode(384, 612, "Team Lead", UIColor.FromRGB(4, 142, 135));
            node6  = AddNode(564, 612, "Team Lead", UIColor.FromRGB(4, 142, 135));
            node7  = AddNode(744, 612, "Team Lead", UIColor.FromRGB(4, 142, 135));
            node8  = AddNode(108, 828, "Trainee", UIColor.FromRGB(206, 98, 9));
            node9  = AddNode(324, 828, "Trainee", UIColor.FromRGB(206, 98, 9));
            node10 = AddNode(648, 828, "Trainee", UIColor.FromRGB(206, 98, 9));
            node11 = AddNode(864, 828, "Trainee", UIColor.FromRGB(206, 98, 9));


            diagram.AddNode(node1);
            diagram.AddNode(node2);
            diagram.AddNode(node3);
            diagram.AddNode(node4);
            diagram.AddNode(node5);
            diagram.AddNode(node6);
            diagram.AddNode(node7);
            diagram.AddNode(node8);
            diagram.AddNode(node9);
            diagram.AddNode(node10);
            diagram.AddNode(node11);
            diagram.AddConnector(AddConnector(node1, node2));
            diagram.AddConnector(AddConnector(node1, node3));
            diagram.AddConnector(AddConnector(node2, node4));
            diagram.AddConnector(AddConnector(node2, node5));
            diagram.AddConnector(AddConnector(node3, node6));
            diagram.AddConnector(AddConnector(node3, node7));
            diagram.AddConnector(AddConnector(node4, node8));
            diagram.AddConnector(AddConnector(node4, node9));
            diagram.AddConnector(AddConnector(node7, node10));
            diagram.AddConnector(AddConnector(node7, node11));
            diagram.Loaded += Diagram_Loaded;
            this.AddSubview(diagram);
            HeaderBar.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, 60);
            this.AddSubview(HeaderBar);
            model.PickerChanged += SelectedIndexChanged;
        }
Exemple #10
0
        public override View GetSampleContent(Context context)
        {
            //Initialize the SfDiagram instance and set background.
            SfDiagram Diagram = new SfDiagram(context);

            Diagram.BackgroundColor = Color.White;

            //Create nodes and set the offset, size and other properties.
            Node n1 = new Node(context);

            n1.ShapeType         = ShapeType.RoundedRectangle;
            n1.CornerRadius      = 90 * MainActivity.factor;
            n1.OffsetX           = 185 * MainActivity.factor;
            n1.OffsetY           = 80 * MainActivity.factor;
            n1.Width             = 320 * MainActivity.factor;
            n1.Height            = 110 * MainActivity.factor;
            n1.Style.Brush       = new SolidBrush(Color.Rgb(49, 162, 255));
            n1.Style.StrokeBrush = new SolidBrush(Color.Rgb(23, 132, 206));
            TextView content1 = CreateLabel(context, "New idea identified", (int)n1.Width, Color.Rgb(255, 255, 255));

            n1.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content1
            });
            Diagram.AddNode(n1);

            Node n2 = new Node(context);

            n2.OffsetX           = 185 * MainActivity.factor;
            n2.OffsetY           = 280 * MainActivity.factor;
            n2.Width             = 320 * MainActivity.factor;
            n2.Height            = 110 * MainActivity.factor;
            n2.ShapeType         = ShapeType.RoundedRectangle;
            n2.CornerRadius      = 15 * MainActivity.factor;
            n2.Style.Brush       = new SolidBrush(Color.Rgb(49, 162, 255));
            n2.Style.StrokeBrush = new SolidBrush(Color.Rgb(23, 132, 206));
            TextView content2 = CreateLabel(context, "Meeting With Boards", (int)n2.Width, Color.Rgb(255, 255, 255));

            n2.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content2
            });
            Diagram.AddNode(n2);

            Node n3 = new Node(context);

            n3.ShapeType         = ShapeType.Diamond;
            n3.OffsetX           = 195 * MainActivity.factor;
            n3.OffsetY           = 480 * MainActivity.factor;
            n3.Width             = 300 * MainActivity.factor;
            n3.Height            = 300 * MainActivity.factor;
            n3.Style.Brush       = new SolidBrush(Color.Rgb(0, 194, 192));
            n3.Style.StrokeBrush = new SolidBrush(Color.Rgb(4, 142, 135));
            TextView content3 = CreateLabel(context, "Board decides" + "\n" + "whether to" + "\n" + "proceed", (int)n3.Width, Color.Rgb(255, 255, 255));

            n3.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content3
            });
            Diagram.AddNode(n3);

            Node n4 = new Node(context);

            n4.ShapeType         = ShapeType.Diamond;
            n4.OffsetX           = 195 * MainActivity.factor;
            n4.OffsetY           = 870 * MainActivity.factor;
            n4.Width             = 300 * MainActivity.factor;
            n4.Height            = 300 * MainActivity.factor;
            n4.Style.Brush       = new SolidBrush(Color.Rgb(0, 194, 192));
            n4.Style.StrokeBrush = new SolidBrush(Color.Rgb(4, 142, 135));
            TextView content4 = CreateLabel(context, "Find Project" + "\n" + "Manager, write" + "\n" + "specification", (int)n4.Width, Color.Rgb(255, 255, 255));

            n4.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content4
            });
            Diagram.AddNode(n4);

            Node n5 = new Node(context);

            n5.Style.Brush       = new SolidBrush(Color.Rgb(49, 162, 255));
            n5.Style.StrokeBrush = new SolidBrush(Color.Rgb(23, 132, 206));
            n5.OffsetX           = 185 * MainActivity.factor;
            n5.OffsetY           = 1260 * MainActivity.factor;
            n5.Width             = 320 * MainActivity.factor;
            n5.Height            = 110 * MainActivity.factor;
            n5.ShapeType         = ShapeType.RoundedRectangle;
            n5.CornerRadius      = 90 * MainActivity.factor;
            TextView content5 = CreateLabel(context, "Implement and deliver", (int)n5.Width, Color.Rgb(255, 255, 255));

            n5.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content5
            });
            Diagram.AddNode(n5);

            Node n6 = new Node(context);

            n6.Style.Brush       = new SolidBrush(Color.Rgb(239, 75, 93));
            n6.Style.StrokeBrush = new SolidBrush(Color.Rgb(201, 32, 61));
            n6.OffsetX           = 674 * MainActivity.factor;
            n6.OffsetY           = 575 * MainActivity.factor;
            n6.Width             = 320 * MainActivity.factor;
            n6.Height            = 110 * MainActivity.factor;
            n6.ShapeType         = ShapeType.RoundedRectangle;
            n6.CornerRadius      = 15 * MainActivity.factor;
            TextView content6 = CreateLabel(context, "Reject and report the reason", (int)n6.Width, Color.Rgb(255, 255, 255));

            n6.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content6
            });
            Diagram.AddNode(n6);

            Node n7 = new Node(context);

            n7.Style.Brush       = new SolidBrush(Color.Rgb(239, 75, 93));
            n7.Style.StrokeBrush = new SolidBrush(Color.Rgb(201, 32, 61));
            n7.OffsetX           = 674 * MainActivity.factor;
            n7.OffsetY           = 965.599f * MainActivity.factor;
            n7.Width             = 320 * MainActivity.factor;
            n7.Height            = 110 * MainActivity.factor;
            n7.ShapeType         = ShapeType.RoundedRectangle;
            n7.CornerRadius      = 15 * MainActivity.factor;
            TextView content7 = CreateLabel(context, "Hire new resources", (int)n7.Width, Color.Rgb(255, 255, 255));

            n7.Annotations.Add(new Annotation()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Content = content7
            });
            Diagram.AddNode(n7);

            //Create connector with its source and target node.
            Connector c1 = new Connector(context, n1, n2);

            Diagram.AddConnector(c1);

            Connector c2 = new Connector(context, n2, n3);

            Diagram.AddConnector(c2);

            Connector c3 = new Connector(context, n3, n4);
            //Create label for the connector.
            TextView label = CreateConnectorLabel(context, "Yes", 35, 10, 100, 50, GravityFlags.Right);

            label.SetPadding((int)(10 * MainActivity.factor), 0, (int)(10 * MainActivity.factor), (int)(10 * MainActivity.factor));
            c3.Annotations.Add(new Annotation()
            {
                Content = label, HorizontalAlignment = HorizontalAlignment.Left
            });
            Diagram.AddConnector(c3);

            Connector c4     = new Connector(context, n4, n5);
            TextView  label2 = CreateConnectorLabel(context, "Yes", 35, 10, 100, 50, GravityFlags.Right);

            label2.SetPadding((int)(10 * MainActivity.factor), 0, (int)(10 * MainActivity.factor), (int)(10 * MainActivity.factor));
            c4.Annotations.Add(new Annotation()
            {
                Content = label2, HorizontalAlignment = HorizontalAlignment.Left
            });
            Diagram.AddConnector(c4);
            Diagram.EnableSelection = false;
            Connector c5     = new Connector(context, n3, n6);
            TextView  label3 = CreateConnectorLabel(context, "No", 67, 10, 100, 50, GravityFlags.Bottom);

            //label3.SetPadding(0, (int)(10 * MainActivity.factor), (int)(10 * MainActivity.factor), 0);
            c5.Annotations.Add(new Annotation()
            {
                Content = label3
            });
            Diagram.AddConnector(c5);

            Connector c6     = new Connector(context, n4, n7);
            TextView  label4 = CreateConnectorLabel(context, "No", 67, 10, 100, 50, GravityFlags.Bottom);

            //label4.SetPadding(0, 0,(int)( 10* MainActivity.factor), (int)(10 * MainActivity.factor));
            c6.Annotations.Add(new Annotation()
            {
                Content = label4
            });
            Diagram.AddConnector(c6);

            //Set the stroke color for the connector.
            for (int i = 0; i < Diagram.Connectors.Count; i++)
            {
                //Diagram.Connectors[i].TargetDecoratorType = DecoratorType.None;
                Diagram.Connectors[i].Style.StrokeBrush                = new SolidBrush(Color.Rgb(127, 132, 133));
                Diagram.Connectors[i].TargetDecoratorStyle.Fill        = (Color.Rgb(127, 132, 133));
                Diagram.Connectors[i].TargetDecoratorStyle.StrokeColor = (Color.Rgb(127, 132, 133));
                Diagram.Connectors[i].TargetDecoratorStyle.StrokeWidth = 4 * MainActivity.factor;
                Diagram.Connectors[i].TargetDecoratorStyle.Size        = 14 * MainActivity.factor;
                Diagram.Connectors[i].Style.StrokeWidth                = 1 * MainActivity.factor;
            }
            //Set the stroke size for node.
            for (int i = 0; i < Diagram.Nodes.Count; i++)
            {
                Diagram.Nodes[i].Style.StrokeWidth = 1;
            }
            return(Diagram);
        }