protected void nDrawingViewDocument_AsyncClick(object sender, EventArgs e) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; string command = ActiveCommand; ToolbarButton button = GetButtonByCommand(command); if (command.StartsWith("fill:")) { command = "fill"; } switch (command) { case "createShape": CreateShape(args); break; case "moveSelect": MoveOrSelect(args); break; case "connect": Connect(args); break; case "delete": Delete(args); break; case "fill": Fill(args, button.Color); break; } }
private void ColorPieSegment(NStateObject state, EventArgs e, Color c) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NChartSessionStateObject chartState = state as NChartSessionStateObject; NHitTestResult result = chartState.HitTest(args); NRootPanel rootPanel = chartState.Document.RootPanel; if (result.ChartElement == ChartElement.DataPoint) { NPieSeries pieSeries = result.Series as NPieSeries; for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.FillStyles[i] = new NColorFillStyle(c); pieSeries.BorderStyles[i] = new NStrokeStyle(1, Color.White); } else { int colorIndex = i % NExampleUC.arrCustomColors2.Length; Color color = NExampleUC.arrCustomColors2[colorIndex]; pieSeries.FillStyles[i] = new NColorFillStyle(color); pieSeries.BorderStyles[i] = new NStrokeStyle(1, color); } } } }
void Delete(NCallbackMouseEventArgs args) { nDrawingViewDocument.Document.HistoryService.StartTransaction("Delete"); try { NNodeList clickedNodes = nDrawingViewDocument.HitTest(args); NNodeList clickedShapes = clickedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); if (clickedShapes.Count != 0) { NShape clickedShape = clickedShapes[clickedShapes.Count - 1] as NShape; nDrawingViewDocument.Document.ActiveLayer.RemoveChild(clickedShape); } else { NNodeList clickedConnectors = clickedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape1D); if (clickedConnectors.Count != 0) { NShape clickedConnector = clickedConnectors[clickedConnectors.Count - 1] as NShape; nDrawingViewDocument.Document.ActiveLayer.RemoveChild(clickedConnector); } } } finally { nDrawingViewDocument.Document.HistoryService.Commit(); } }
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(); }
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); } } }
private void ExplodePieSegment(NStateObject state, EventArgs e, int offset) { // this method is called when the web control operates in the Nevron Instant Callback mode NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NChartSessionStateObject chartState = state as NChartSessionStateObject; NHitTestResult result = chartState.HitTest(args); NRootPanel rootPanel = chartState.Document.RootPanel; if (result.ChartElement == ChartElement.DataPoint) { NPieSeries pieSeries = result.Series as NPieSeries; pieSeries.Detachments.Clear(); for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.Detachments.Add(offset); } else { pieSeries.Detachments.Add(0); } } } }
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); }
protected void nChartControl1_AsyncMouseMove(object sender, EventArgs e) { // this method is called when the web control operates in the standard Microsoft AJAX mode DoSimulateResponseDelay(); NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; ExplodePieSegment(args, 5); }
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(); } }
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(); }
void CreateShape(NCallbackMouseEventArgs args) { nDrawingViewDocument.Document.HistoryService.StartTransaction("CreateShape"); try { // create the new shape NNodeList shapes = nDrawingViewLibrary.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); int length = shapes.Count; NShape newShape = null; for (int i = 0; i < length; i++) { NShape s = shapes[i] as NShape; if (s.Tag != null && s.Tag.ToString() == "selected") { newShape = s.CloneWithNewUniqueId(new Hashtable()) as NShape; newShape.Center = new NPointF(args.Point.X, args.Point.Y); nDrawingViewDocument.Document.ActiveLayer.AddChild(newShape); break; } } if (newShape == null) { return; } // select the new shape NNodeList docShapes = nDrawingViewDocument.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); length = docShapes.Count; for (int i = 0; i < length; i++) { NShape s = docShapes[i] as NShape; if (s.UniqueId == newShape.UniqueId) { s.Style.StrokeStyle = new NStrokeStyle(2, documentSelectedShapeBorderColor); } else { s.Style.StrokeStyle = null; } } SelectedShapeId = newShape.UniqueId; } finally { nDrawingViewDocument.Document.HistoryService.Commit(); } }
protected NRectangleShape HitTestCell(NStateObject state, NCallbackMouseEventArgs args) { NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject; NNodeList nodes = diagramState.HitTest(args); NNodeList shapes = nodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); foreach (NShape node in shapes) { if (!(node.Tag is CellState)) { continue; } return(node as NRectangleShape); } return(null); }
void Fill(NCallbackMouseEventArgs args, Color c) { nDrawingViewDocument.Document.HistoryService.StartTransaction("Fill"); try { NNodeList clickedNodes = nDrawingViewDocument.HitTest(args); NNodeList clickedShapes = clickedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); if (clickedShapes.Count == 0) { return; } NShape clickedShape = clickedShapes[clickedShapes.Count - 1] as NShape; clickedShape.Style.FillStyle = new NColorFillStyle(c); } finally { nDrawingViewDocument.Document.HistoryService.Commit(); } }
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); }
protected void NDrawingView1_AsyncMouseOut(object sender, EventArgs e) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; if (args.ItemId == null) { return; } NElementAtomIdentifier id = new NElementAtomIdentifier(args.ItemId); NEllipsePath path = id.FindInDocument(NDrawingView1.Document) as NEllipsePath; if (path == null) { return; } NShape shape = NSceneTree.FirstAncestor(path, NFilters.TypeNShape) as NShape; shape.Style.FillStyle = new NColorFillStyle(Color.Linen); }
protected NEllipseShape HitTestEllipse(NStateObject state, NCallbackMouseEventArgs args) { NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject; NNodeList nodes = diagramState.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); }
protected void NDrawingView1_AsyncMouseMove(object sender, EventArgs e) { // this method is called when the web control operates in the standard Microsoft AJAX mode DoSimulateResponseDelay(); NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NEllipseShape rotatingEllipse = NDrawingView1.Document.ActiveLayer.GetChildByName("RotatingEllipse", 0) as NEllipseShape; if (rotatingEllipse == null) { return; } NEllipseShape rotatingEllipse2 = NDrawingView1.Document.ActiveLayer.GetChildByName("RotatingEllipse2", 0) as NEllipseShape; if (rotatingEllipse2 == null) { return; } NEllipseShape centerEllipse = NDrawingView1.Document.ActiveLayer.GetChildByName("CenterEllipse", 0) as NEllipseShape; if (centerEllipse == null) { return; } rotatingEllipse.Style.StrokeStyle = null; rotatingEllipse2.Style.StrokeStyle = null; centerEllipse.Style.StrokeStyle = null; NEllipseShape ellipse = HitTestEllipse(args); if (ellipse == null) { return; } ellipse.Style.StrokeStyle = new NStrokeStyle(2f, Color.Snow); NDrawingView1.Document.RefreshAllViews(); }
protected void nChartControl1_AsyncMouseOver(object sender, EventArgs e) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; if (args.ItemId == null) { return; } NElementAtomIdentifier id = new NElementAtomIdentifier(args.ItemId); NDataPoint dataPoint = id.FindInDocument(nChartControl1.Document) as NDataPoint; if (dataPoint == null) { return; } NRootPanel rootPanel = nChartControl1.Document.RootPanel; NPieSeries pieSeries = rootPanel.Charts[0].Series[0] as NPieSeries; pieSeries.FillStyles[dataPoint.IndexInSeries] = new NColorFillStyle(Color.White); }
private void ExplodePieSegment(NStateObject state, EventArgs e, int offset) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NChartSessionStateObject chartState = state as NChartSessionStateObject; NHitTestResult result = chartState.HitTest(args); if (result.ChartElement == ChartElement.DataPoint) { NPieSeries pieSeries = result.Series as NPieSeries; pieSeries.Detachments.Clear(); for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.Detachments.Add(offset); } else { pieSeries.Detachments.Add(0); } } } }
private void ExplodePieSegment(EventArgs e, int offset) { // this method is called when the web control operates in the standard Microsoft AJAX mode NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NHitTestResult result = nChartControl1.HitTest(args); NRootPanel rootPanel = nChartControl1.Document.RootPanel; if (result.ChartElement == ChartElement.DataPoint) { NPieSeries pieSeries = result.Series as NPieSeries; pieSeries.Detachments.Clear(); for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.Detachments.Add(offset); } else { pieSeries.Detachments.Add(0); } } } }
protected void nDrawingViewToolbar_AsyncClick(object sender, EventArgs e) { // get the selected command NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NNodeList clickedNodes = nDrawingViewToolbar.HitTest(args); NNodeList clickedGroups = clickedNodes.Filter(Nevron.Diagram.Filters.NFilters.TypeNGroup); if (clickedGroups.Count == 0) { return; } NGroup clickedGroup = clickedGroups[0] as NGroup; string command = clickedGroup.Tag as string; if (command == null) { return; } // get the selected button ToolbarButton selectedBtn = GetButtonByCommand(command); if (!selectedBtn.IsClientSide) { this.ActiveCommand = command; } else { return; } // highlight the clicked button NShape selectedCoverShape = clickedGroup.Shapes.GetChildByName("coverShape", 0) as NShape; if (selectedCoverShape == null) { return; } NNodeList groups = nDrawingViewToolbar.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.TypeNGroup); int length = groups.Count; for (int i = 0; i < length; i++) { NGroup group = groups[i] as NGroup; ToolbarButton btn = GetButtonByCommand(group.Tag as string); if (btn == null) { continue; } NShape coverShape = group.Shapes.GetChildByName("coverShape", 0) as NShape; if (!btn.IsSeparator) { if (!object.ReferenceEquals(selectedCoverShape, coverShape) && !btn.IsClientSide) { if (btn.IsColorSelector) { coverShape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(80, Color.White)); } else { coverShape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(160, Color.White)); } coverShape.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(160, Color.White)); coverShape.Style.ShadowStyle = null; } else { coverShape.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White)); coverShape.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.White)); coverShape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(70, Color.Black), new NPointL(1, 0)); } } } }
public override void OnAsyncClick(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { NPointF ptViewPoint = new NPointF((float)args.Point.X, 0); UpdateDataWindow(webControlId, context, state, ptViewPoint); }
public override void OnAsyncMouseMove(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { DoSimulateResponseDelay(); ChangeCurrentShapeShadow(webControlId, context, state, args); }
public override void OnAsyncDoubleClick(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { DoSimulateResponseDelay(); ChangeCurrentShapeColor(webControlId, context, state, args, Color.Red); }
void Connect(NCallbackMouseEventArgs args) { NNodeList clickedNodes = nDrawingViewDocument.HitTest(args); NNodeList clickedShapes = clickedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); if (clickedShapes.Count == 0) { return; } NShape clickedShape; if (SelectedShapeId == Guid.Empty) { // select a shape nDrawingViewDocument.Document.HistoryService.Pause(); try { clickedShape = clickedShapes[clickedShapes.Count - 1] as NShape; NNodeList shapes = nDrawingViewDocument.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); int length = shapes.Count; for (int i = 0; i < length; i++) { NShape s = shapes[i] as NShape; if (s.UniqueId == clickedShape.UniqueId) { s.Style.StrokeStyle = new NStrokeStyle(2, documentSelectedShapeBorderColor); } else { s.Style.StrokeStyle = null; } } SelectedShapeId = clickedShape.UniqueId; return; } finally { nDrawingViewDocument.Document.HistoryService.Resume(); } } NShape selectedShape = nDrawingViewDocument.Document.ActiveLayer.GetChildFromUniqueId(SelectedShapeId) as NShape; nDrawingViewDocument.Document.HistoryService.StartTransaction("Connect"); try { // connect shapes clickedShape = clickedShapes[clickedShapes.Count - 1] as NShape; NRoutableConnector connector = new NRoutableConnector(RoutableConnectorType.DynamicHV); nDrawingViewDocument.Document.ActiveLayer.AddChild(connector); connector.StyleSheetName = "Connectors"; connector.FromShape = selectedShape; connector.ToShape = clickedShape; connector.RerouteAutomatically = RerouteAutomatically.Always; if (connector.IsReflexive) { connector.Reflex(); } else { connector.Reroute(); } } finally { nDrawingViewDocument.Document.HistoryService.Commit(); } // deselect the shape nDrawingViewDocument.Document.HistoryService.Pause(); try { selectedShape.Style.StrokeStyle = null; SelectedShapeId = Guid.Empty; } finally { nDrawingViewDocument.Document.HistoryService.Resume(); } }
public override void OnAsyncMouseMove(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { // init configuration InitializeConfigurationFields(); // highlight underlying cell NRectangleShape cell = HitTestCell(state, args); if (cell == null) { return; } HighliteCell(state, cell); }
public override void OnAsyncMouseUp(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { // init configuration InitializeConfigurationFields(); // toggle the underlying cell NRectangleShape cell = HitTestCell(state, args); if (cell == null) { return; } if ((CellState)cell.Tag == CellState.PinnedAlive) { cell.Tag = CellState.Alive; } else if ((CellState)cell.Tag == CellState.PinnedDead) { cell.Tag = CellState.Dead; } else { return; } UpdateStyles(state); }
public override void OnAsyncDoubleClick(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { // init configuration InitializeConfigurationFields(); // clear the board Clear(state); }
public override void OnAsyncClick(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject; NNodeList clickedNodes = diagramState.HitTest(args); NNodeList clickedShapes = clickedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); NNodeList shapes = diagramState.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); int length = shapes.Count; for (int i = 0; i < length; i++) { NShape s = shapes[i] as NShape; s.Style.FillStyle = null; s.Style.StrokeStyle = null; s.Style.ShadowStyle = null; s.Tag = null; } if (clickedShapes.Count == 0) { return; } NShape clickedShape = clickedShapes[0] as NShape; clickedShape.Style.FillStyle = new NColorFillStyle(libraryHighlightFillColor); clickedShape.Style.StrokeStyle = new NStrokeStyle(libraryHighlightBorderColor); clickedShape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(90, Color.Black), new NPointL(2, 1)); clickedShape.Tag = "selected"; }
public override void OnAsyncMouseMove(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { // this method is called when the web control operates in the Nevron Instant Callback mode DoSimulateResponseDelay(); NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject; NEllipseShape rotatingEllipse = diagramState.Document.ActiveLayer.GetChildByName("RotatingEllipse", 0) as NEllipseShape; if (rotatingEllipse == null) { return; } NEllipseShape rotatingEllipse2 = diagramState.Document.ActiveLayer.GetChildByName("RotatingEllipse2", 0) as NEllipseShape; if (rotatingEllipse2 == null) { return; } NEllipseShape centerEllipse = diagramState.Document.ActiveLayer.GetChildByName("CenterEllipse", 0) as NEllipseShape; if (centerEllipse == null) { return; } rotatingEllipse.Style.StrokeStyle = null; rotatingEllipse2.Style.StrokeStyle = null; centerEllipse.Style.StrokeStyle = null; NEllipseShape ellipse = HitTestEllipse(state, args); if (ellipse == null) { return; } ellipse.Style.StrokeStyle = new NStrokeStyle(2f, Color.Snow); diagramState.Document.RefreshAllViews(); }