Exemplo n.º 1
0
        protected void OnMouseEvent(object sender, EventArgs e)
        {
            NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs;

            NNodeList allShapes = NDrawingView1.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D);

            NNodeList affectedNodes  = NDrawingView1.HitTest(args);
            NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

            int length;

            length = allShapes.Count;
            for (int i = 0; i < length; i++)
            {
                NShape shape = allShapes[i] as NShape;
                shape.Style.ShadowStyle = null;
                if (shape.Tag != null)
                {
                    shape.Style.FillStyle = new NColorFillStyle((Color)shape.Tag);
                }
            }

            length = affectedShapes.Count;
            for (int i = 0; i < length; i++)
            {
                NShape shape = affectedShapes[i] as NShape;
                shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(96, Color.Black), new NPointL(3, 3), 1, new NLength(10));
                NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle;
                if (fs != null && fs.Color != Color.White)
                {
                    shape.Tag             = fs.Color;
                    shape.Style.FillStyle = new NColorFillStyle(Color.YellowGreen);
                }
            }
        }
        protected void NDrawingView1_AsyncClick(object sender, EventArgs e)
        {
            NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs;

            NNodeList            nodes  = NDrawingView1.HitTest(args);
            NNodeList            shapes = nodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);
            NExpandCollapseCheck check  = null;
            int length = shapes.Count;

            for (int i = 0; i < length; i++)
            {
                if (shapes[i] is NExpandCollapseCheck)
                {
                    check = shapes[i] as NExpandCollapseCheck;
                    break;
                }
            }
            if (check == null)
            {
                return;
            }

            NExpandableShape shape = check.ParentNode.ParentNode as NExpandableShape;

            shape.Expand(!shape.Expanded);
        }
Exemplo n.º 3
0
        protected void NDrawingView1_AsyncClick(object sender, EventArgs e)
        {
            NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs;

            NNodeList nodes  = NDrawingView1.HitTest(args);
            NNodeList shapes = nodes.Filter(TABLE_SHAPE_FILTER);

            if (shapes.Count == 0)
            {
                NDrawingView1.Document.Tag = null;
                return;
            }

            NNodeList decorators = nodes.Filter(DECORATOR_FILTER);

            if (decorators.Count > 0)
            {
                ((NShowHideSubtreeDecorator)decorators[0]).ToggleState();
            }

            NTableShape table    = (NTableShape)shapes[0];
            NEmployee   employee = (NEmployee)table.Tag;

            NDrawingView1.Document.Tag = employee;
            NDrawingView1.Document.SmartRefreshAllViews();
        }
Exemplo n.º 4
0
        protected void NDrawingView1_AsyncClick(object sender, EventArgs e)
        {
            NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs;
            NNodeList nodes      = NDrawingView1.HitTest(args);
            NNodeList decorators = nodes.Filter(DecoratorFilter);

            if (decorators.Count > 0)
            {
                ((NShowHideSubtreeDecorator)decorators[0]).ToggleState();
            }

            NDrawingView1.Document.SmartRefreshAllViews();
        }
Exemplo n.º 5
0
        protected void NDrawingView1_AsyncClick(object sender, EventArgs e)
        {
            NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs;

            NNodeList nodes      = NDrawingView1.HitTest(args);
            NNodeList decorators = nodes.Filter(DECORATOR_FILTER);

            if (decorators.Count > 0)
            {
                ((NShowHideSubtreeDecorator)decorators[0]).ToggleState();
                DoLayout();
            }
        }
Exemplo n.º 6
0
        protected NEllipseShape HitTestEllipse(NCallbackMouseEventArgs args)
        {
            NNodeList nodes  = NDrawingView1.HitTest(args);
            NNodeList shapes = nodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

            foreach (NShape node in shapes)
            {
                if (!(node is NEllipseShape))
                {
                    continue;
                }
                if (!node.Name.Contains("Ellipse"))
                {
                    continue;
                }
                return(node as NEllipseShape);
            }

            return(null);
        }
Exemplo n.º 7
0
        protected void NDrawingView1_AsyncClick(object sender, EventArgs e)
        {
            NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs;

            NNodeList nodes  = NDrawingView1.HitTest(args);
            NNodeList shapes = nodes.Filter(CELL_FILTER);

            if (shapes.Count == 0)
            {
                return;
            }

            NTableCell cell = (NTableCell)shapes[0];

            if (cell.ParentNode.ParentNode != table)
            {
                return;
            }

            if (cell.StyleSheetName != null && cell.StyleSheetName != string.Empty)
            {
                if (CellClicked(cell))
                {
                    UpdateInfo();

                    // Check for end of the game
                    string status = string.Empty;
                    if (AllClear())
                    {
                        score *= 2;
                        status = "You've cleared all cells !!!" + Environment.NewLine;
                    }

                    if (status == string.Empty && GameOver())
                    {
                        status = "Game Over !" + Environment.NewLine;
                    }

                    if (status != string.Empty)
                    {
                        status += "Your score is " + score.ToString();
                        NTableShape gameOver = new NTableShape();
                        document.ActiveLayer.AddChild(gameOver);

                        gameOver.BeginUpdate();
                        gameOver.CellPadding = new Nevron.Diagram.NMargins(2, 2, 8, 8);
                        gameOver[0, 0].Text  = status;

                        NStyle.SetFillStyle(gameOver, new NAdvancedGradientFillStyle(AdvancedGradientScheme.Ocean1, 0));
                        NStyle.SetStrokeStyle(gameOver, new NStrokeStyle(Color.DarkBlue));

                        NTextStyle textStyle = (NTextStyle)table.ComposeTextStyle().Clone();
                        textStyle.FillStyle = new NColorFillStyle(Color.DarkBlue);
                        NStyle.SetTextStyle(gameOver, textStyle);

                        gameOver.EndUpdate();
                        gameOver.Center = table.Center;
                    }
                }
            }
        }