예제 #1
0
        protected void NDrawingView1_AsyncCustomCommand(object sender, EventArgs e)
        {
            //	this method is called when the web control operates in the standard Microsoft AJAX mode
            NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs;

            switch (args.Command.Name)
            {
            case "restartApplication":
                try
                {
                    System.Web.HttpRuntime.UnloadAppDomain();
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("NDrawingView1_AsyncCustomCommand, restartApplication: " + ex.Message);
                }
                break;

            case "enforceResponseDelay":
                try
                {
                    SimulateResponseDelay = true;
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("NDrawingView1_AsyncCustomCommand, changeResponseDelay: " + ex.Message);
                }
                break;
            }
        }
예제 #2
0
        protected void NDrawingView1_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs;

            switch (args.Command.Name)
            {
            case "randomGrid1Button":
                CreateRandomDiagram(10, 10);
                break;

            case "randomGrid2Button":
                CreateRandomDiagram(15, 15);
                break;

            case "triangularGrid1Button":
                CreateTriangularGridDiagram(6);
                break;

            case "triangularGrid2Button":
                CreateTriangularGridDiagram(8);
                break;
            }

            PerformLayout(args.Command.Arguments);
            m_bClientSideRedrawRequired = true;
        }
예제 #3
0
        protected void NDrawingView1_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs;

            PerformLayout(args.Command.Arguments);
            m_bClientSideRedrawRequired = true;
        }
        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;
            }
        }
예제 #5
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;
            }
        }
        protected void nChartControl2_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs;

            switch (args.Command.Name)
            {
            case "displayDataWindow":
                double dataWindowWidth = double.Parse(args.Command.Arguments["width"] as string);

                NCartesianChart   zoomChart = nChartControl2.Charts[0] as NCartesianChart;
                NSmoothLineSeries zoomLine  = zoomChart.Series[0] as NSmoothLineSeries;

                NCartesianChart previewChart = nChartControl1.Charts[0] as NCartesianChart;
                NAxis           previewXAxis = previewChart.Axis(StandardAxis.PrimaryX);

                NPointF    ptViewPoint   = new NPointF(float.Parse(args.Command.Arguments["x"] as string), 0);
                NVector2DD vecScalePoint = new NVector2DD();

                using (NChartRasterView view = new NChartRasterView(nChartControl1.Document, nChartControl1.Dimensions, NResolution.ScreenResolution))
                {
                    view.RecalcLayout();

                    NViewToScale2DTransformation viewToScale = new NViewToScale2DTransformation(
                        view.Context,
                        previewChart,
                        (int)StandardAxis.PrimaryX,
                        (int)StandardAxis.PrimaryY
                        );

                    if (viewToScale.Transform(ptViewPoint, ref vecScalePoint))
                    {
                        double rangeMin = vecScalePoint.X - dataWindowWidth / 2;
                        rangeMin = previewXAxis.Scale.ViewRange.GetValueInRange(rangeMin);

                        double rangeMax = rangeMin + dataWindowWidth;
                        rangeMax = previewXAxis.Scale.ViewRange.GetValueInRange(rangeMax);

                        rangeMin = rangeMax - dataWindowWidth;

                        // reinitialize data points
                        zoomLine.XValues.Clear();
                        zoomLine.Values.Clear();
                        for (int i = (int)rangeMin; i <= (int)rangeMax; i++)
                        {
                            zoomLine.XValues.Add(i);
                            zoomLine.Values.Add(waveData[i]);
                        }
                    }
                }
                break;
            }
        }
        protected void nDrawingViewDocument_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs;

            switch (args.Command.Name)
            {
            case "undo":
                try
                {
                    nDrawingViewDocument.Document.HistoryService.Undo();
                    nDrawingViewDocument.Document.UpdateAllViews();
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("nDrawingViewDocument_AsyncCustomCommand, undo: " + ex.Message);
                }
                break;

            case "redo":
                try
                {
                    nDrawingViewDocument.Document.HistoryService.Redo();
                    nDrawingViewDocument.Document.UpdateAllViews();
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("nDrawingViewDocument_AsyncCustomCommand, redo: " + ex.Message);
                }
                break;

            case "text":
                try
                {
                    NShape selectedShape = nDrawingViewDocument.Document.ActiveLayer.GetChildFromUniqueId(SelectedShapeId) as NShape;
                    if (selectedShape == null)
                    {
                        break;
                    }
                    string text = args.Command.Arguments["text"] as string;
                    if (text == null)
                    {
                        break;
                    }
                    selectedShape.Text = text;
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("nDrawingViewDocument_AsyncCustomCommand, redo: " + ex.Message);
                }
                break;
            }
        }
        protected void NDrawingView1_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs;

            switch (args.Command.Name)
            {
            case "btn1":
                CreateTree(4, 3);
                break;

            case "btn2":
                CreateTree(5, 2);
                break;
            }

            PerformLayout(args.Command.Arguments);
            m_bClientSideRedrawRequired = true;
        }
예제 #9
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;
            }
        }
 public override void OnAsyncCustomCommand(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackCustomCommandArgs args)
 {
     switch (args.Command.Name)
     {
     case "setDataWindowWidth":
         NPointF ptViewPoint = new NPointF(float.Parse(args.Command.Arguments["x"] as string), 0f);
         DataWindowWidth = double.Parse(args.Command.Arguments["width"] as string);
         UpdateDataWindow(webControlId, context, state, ptViewPoint);
         break;
     }
 }
예제 #11
0
            public override void OnAsyncCustomCommand(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackCustomCommandArgs args)
            {
                //	this method is called when the web control operates in the Nevron Instant Callback mode
                switch (args.Command.Name)
                {
                case "restartApplication":
                    try
                    {
                        System.Web.HttpRuntime.UnloadAppDomain();
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine("OnAsyncCustomCommand, restartApplication: " + ex.Message);
                    }
                    break;

                case "enforceResponseDelay":
                    try
                    {
                        SimulateResponseDelay = true;
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine("OnAsyncCustomCommand, changeResponseDelay: " + ex.Message);
                    }
                    break;
                }
            }
            public override void OnAsyncCustomCommand(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackCustomCommandArgs args)
            {
                switch (args.Command.Name)
                {
                case "displayHitsForDate":
                    NChartSessionStateObject chartState = state as NChartSessionStateObject;
                    NRootPanel rootPanel = chartState.Document.RootPanel;
                    NPieSeries pieSeries = rootPanel.Charts[0].Series[0] as NPieSeries;

                    int   dataPointIndex = int.Parse(args.Command.Arguments["dataPointIndex"] as string);
                    int[] data           = NDrillDownDemoUC.hitsPerDayPerRegion[dataPointIndex];

                    pieSeries.Values.Clear();
                    pieSeries.Labels.Clear();
                    int length = hitsPerDayPerRegion[0].Length;
                    for (int i = 0; i < length; i++)
                    {
                        pieSeries.Values.Add(data[i]);
                        pieSeries.Labels.Add(NDrillDownDemoUC.regionNames[i]);
                    }

                    DateTime selectedDate = NDrillDownDemoUC.startDate.AddDays(dataPointIndex);
                    NLabel   header       = rootPanel.Labels[0];
                    header.Text = selectedDate.ToString("dd/MMM/yyyy") + ", Hits per Region";

                    break;
                }
            }