Beispiel #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;
            }
        }
            public void SetAjaxData(NAjaxXmlTransportBuilder resultBuilder)
            {
                FieldInfo[] fields = this.GetType().GetFields();
                int         i, count = fields.Length;
                string      format;

                for (i = 0; i < count; i++)
                {
                    NAjaxXmlDataSection dataSection = new NAjaxXmlDataSection(fields[i].Name.ToLower());
                    switch (fields[i].FieldType.Name)
                    {
                    case "DateTime":
                        dataSection.Data = string.Format(CULTURE, "{0:MMMM dd, yyyy}", fields[i].GetValue(this));
                        break;

                    default:
                        format           = dataSection.Name == "salary" ? ":C" : string.Empty;
                        dataSection.Data = string.Format(CULTURE, "{0" + format + "}", fields[i].GetValue(this));
                        break;
                    }

                    switch (dataSection.Name)
                    {
                    case "salary":
                        dataSection.Data = "Salary: " + dataSection.Data;
                        break;

                    case "birthdate":
                        dataSection.Data = "Birth Date: " + dataSection.Data;
                        break;
                    }

                    resultBuilder.AddDataSection(dataSection);
                }
            }
        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;
            }
        }
Beispiel #4
0
        protected void NDrawingView1_AsyncQueryCommandResult(object sender, EventArgs e)
        {
            NCallbackQueryCommandResultArgs args          = e as NCallbackQueryCommandResultArgs;
            NAjaxXmlTransportBuilder        resultBuilder = args.ResultBuilder;

            if (m_bClientSideRedrawRequired && !resultBuilder.ContainsRedrawDataSection())
            {
                resultBuilder.AddRedrawDataSection(NDrawingView1);
            }
        }
        protected void nDrawingViewDocument_AsyncQueryCommandResult(object sender, EventArgs e)
        {
            NCallbackQueryCommandResultArgs args          = e as NCallbackQueryCommandResultArgs;
            NAjaxXmlTransportBuilder        resultBuilder = args.ResultBuilder;

            switch (args.Command.Name)
            {
            case "undo":
            case "redo":
            case "text":
                //	add a built-in data section that will enforce full image refresh at the client
                if (!resultBuilder.ContainsRedrawDataSection())
                {
                    resultBuilder.AddRedrawDataSection(nDrawingViewDocument);
                }
                break;
            }
        }
        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;
            }
        }