Пример #1
0
        protected void NDrawingView1_AsyncQueryCommandResult(object sender, EventArgs e)
        {
            NCallbackQueryCommandResultArgs args   = e as NCallbackQueryCommandResultArgs;
            NCallbackCommand         command       = args.Command;
            NAjaxXmlTransportBuilder resultBuilder = args.ResultBuilder;

            switch (command.Name)
            {
            case "queryPosition":
                //	build a custom response data section
                NEllipseShape rotatingEllipse = NDrawingView1.Document.ActiveLayer.GetChildByName("RotatingEllipse", 0) as NEllipseShape;
                if (rotatingEllipse != null)
                {
                    NAjaxXmlDataSection dataSection = new NAjaxXmlDataSection("position");
                    dataSection.Data = rotatingEllipse.Center.ToString();
                    resultBuilder.AddDataSection(dataSection);
                }
                break;

            case "changeColor":
                //	add a built-in data section that will enforce full image refresh at the client
                if (clientSideRedrawRequired && !resultBuilder.ContainsRedrawDataSection())
                {
                    resultBuilder.AddRedrawDataSection(NDrawingView1);
                }
                break;

            case "rotate10Degrees":
                if (resultBuilder.ContainsRedrawDataSection() == false)
                {
                    resultBuilder.AddRedrawDataSection(NDrawingView1);
                }
                break;
            }
        }
        protected void nChartControl1_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args    = e as NCallbackCustomCommandArgs;
            NCallbackCommand           command = args.Command;

            NPieSeries pieSeries;

            switch (command.Name)
            {
            case "changeColor":
                string idText = command.Arguments["id"] as string;
                if (idText == null)
                {
                    break;
                }

                NElementAtomIdentifier id   = new NElementAtomIdentifier(idText);
                NChartNode             node = id.FindInDocument(nChartControl1.Document) as NChartNode;
                if (node == null)
                {
                    break;
                }
                NHitTestResult hitTestResult = new NHitTestResult(node);
                if (hitTestResult.ChartElement != ChartElement.DataPoint)
                {
                    break;
                }
                pieSeries = hitTestResult.Series as NPieSeries;
                if (pieSeries == null)
                {
                    break;
                }

                Color c = Color.Red;
                if (command.Arguments["color"].ToString() == "blue")
                {
                    c = Color.Blue;
                }
                NColorFillStyle fs = pieSeries.FillStyles[hitTestResult.DataPointIndex] as NColorFillStyle;
                if (fs == null)
                {
                    break;
                }

                pieSeries.FillStyles[hitTestResult.DataPointIndex] = new NColorFillStyle(c);

                clientSideRedrawRequired = (fs.Color != c);
                break;

            case "rotate10Degrees":
                NRootPanel rootPanel = nChartControl1.Document.RootPanel;
                NPieChart  pieChart  = nChartControl1.Charts[0] as NPieChart;
                pieChart.BeginAngle += 10;
                if (pieChart.BeginAngle >= 360)
                {
                    pieChart.BeginAngle = pieChart.BeginAngle - 360;
                }
                break;
            }
        }
        protected void nChartControl1_AsyncQueryCommandResult(object sender, EventArgs e)
        {
            NCallbackQueryCommandResultArgs args   = e as NCallbackQueryCommandResultArgs;
            NCallbackCommand         command       = args.Command;
            NAjaxXmlTransportBuilder resultBuilder = args.ResultBuilder;

            switch (command.Name)
            {
            case "queryCurrentAngle":
                //	build a custom response data section
                NRootPanel rootPanel = nChartControl1.Document.RootPanel;
                NPieChart  pieChart  = nChartControl1.Charts[0] as NPieChart;

                NAjaxXmlDataSection dataSection = new NAjaxXmlDataSection("angle");
                dataSection.Data = pieChart.BeginAngle.ToString();
                resultBuilder.AddDataSection(dataSection);
                break;

            case "changeColor":
                //	add a built-in data section that will enforce full image refresh at the client
                if (clientSideRedrawRequired && !resultBuilder.ContainsRedrawDataSection())
                {
                    resultBuilder.AddRedrawDataSection(nChartControl1);
                }
                break;

            case "rotate10Degrees":
                if (!resultBuilder.ContainsRedrawDataSection())
                {
                    resultBuilder.AddRedrawDataSection(nChartControl1);
                }
                break;
            }
        }
Пример #4
0
        protected void NDrawingView1_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args    = e as NCallbackCustomCommandArgs;
            NCallbackCommand           command = args.Command;
            string value = command.Arguments["value"].ToString();

            NNodeList decorators = NDrawingView1.Document.ActiveLayer.Descendants(DecoratorFilter, -1);
            int       i, count = decorators.Count;

            switch (command.Name)
            {
            case "background":
                ToggleDecoratorBackgroundShape background = (ToggleDecoratorBackgroundShape)Enum.Parse(typeof(ToggleDecoratorBackgroundShape), value);
                for (i = 0; i < count; i++)
                {
                    ((NToggleDecorator)decorators[i]).Background.Shape = background;
                }

                m_bClientSideRedrawRequired = true;
                break;

            case "symbol":
                ToggleDecoratorSymbolShape symbol = (ToggleDecoratorSymbolShape)Enum.Parse(typeof(ToggleDecoratorSymbolShape), value);
                for (i = 0; i < count; i++)
                {
                    ((NToggleDecorator)decorators[i]).Symbol.Shape = symbol;
                }

                m_bClientSideRedrawRequired = true;
                break;

            case "position":
                NContentAlignment alignment;
                NSizeF            offset;

                if (value == "Left")
                {
                    alignment = new NContentAlignment(ContentAlignment.TopLeft);
                    offset    = new NSizeF(11, 11);
                }
                else
                {
                    alignment = new NContentAlignment(ContentAlignment.TopRight);
                    offset    = new NSizeF(-11, 11);
                }

                for (i = 0; i < count; i++)
                {
                    NToggleDecorator decorator = (NToggleDecorator)decorators[i];
                    decorator.Alignment = alignment;
                    decorator.Offset    = offset;
                }

                m_bClientSideRedrawRequired = true;
                break;
            }
        }
Пример #5
0
        protected void NDrawingView1_AsyncQueryCommandResult(object sender, EventArgs e)
        {
            NCallbackQueryCommandResultArgs args   = e as NCallbackQueryCommandResultArgs;
            NCallbackCommand         command       = args.Command;
            NAjaxXmlTransportBuilder resultBuilder = args.ResultBuilder;

            switch (command.Name)
            {
            case "mouseClick":
                //	build a custom response data section
                NEmployee employee = NDrawingView1.Document.Tag as NEmployee;
                if (employee == null)
                {
                    return;
                }

                employee.SetAjaxData(resultBuilder);
                break;
            }
        }
Пример #6
0
        protected void NDrawingView1_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args    = e as NCallbackCustomCommandArgs;
            NCallbackCommand           command = args.Command;

            switch (command.Name)
            {
            case "changeColor":
                string idText = command.Arguments["id"] as string;
                if (idText == null)
                {
                    break;
                }

                NElementAtomIdentifier id   = new NElementAtomIdentifier(idText);
                NEllipsePath           path = id.FindInDocument(NDrawingView1.Document) as NEllipsePath;
                if (path == null)
                {
                    break;
                }

                NShape shape = NSceneTree.FirstAncestor(path, NFilters.TypeNShape) as NShape;

                Color c = Color.Red;
                if (command.Arguments["color"].ToString() == "blue")
                {
                    c = Color.Blue;
                }

                NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle;
                shape.Style.FillStyle = new NColorFillStyle(c);

                clientSideRedrawRequired = (fs == null || fs.Color != c);
                break;

            case "rotate10Degrees":
                IterateRotatingEllipse(true);
                break;
            }
        }