Skip to content

Commit aac8938

Browse files
1007098: Code standard validation for code example
1 parent dfeeac4 commit aac8938

22 files changed

Lines changed: 458 additions & 230 deletions

Diagram/Server/Pages/Connectors/Events/CollectionChangeEvent.razor

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent @ref="@Diagram" Width="100%" Height="700px" Connectors="@connectors" CollectionChanged="OnCollectionChanged" />
5+
<SfDiagramComponent @ref="_diagram"
6+
Width="100%"
7+
Height="700px"
8+
Connectors="@_connectors"
9+
CollectionChanged="OnCollectionChanged">
10+
</SfDiagramComponent>
611

7-
@code
12+
@code
813
{
9-
private SfDiagramComponent Diagram;
14+
private SfDiagramComponent _diagram;
1015
//Defines diagram's connector collection.
11-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
12-
16+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1317
protected override void OnInitialized()
1418
{
15-
Connector Connector = new Connector()
19+
var connector = new Connector()
1620
{
1721
ID = "connector1",
1822
// Set the source and target point of the connector.
@@ -21,10 +25,9 @@
2125
// Type of the connector segments.
2226
Type = ConnectorSegmentType.Straight
2327
};
24-
connectors.Add(Connector);
28+
_connectors.Add(connector);
2529
}
26-
27-
// Notify the Collection Changed event while changing the collection of the node or connector at run time.
30+
// Notify the Collection Changed event while changing the collection of the connector at run time.
2831
private void OnCollectionChanged(CollectionChangedEventArgs args)
2932
{
3033
//Action to be performed.

Diagram/Server/Pages/Connectors/Events/ConnectionChangeEvent.razor

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent @ref="Diagram" Width="1000px" ConnectionChanging="@OnConnectionChanging" ConnectionChanged="@OnConnectionChange"
6-
Height="500px" Connectors="@connectors" Nodes="@nodes" />
5+
<SfDiagramComponent @ref="_diagram" Width="1000px" ConnectionChanging="@OnConnectionChanging" ConnectionChanged="@OnConnectionChange" Height="500px" Connectors="@_connectors" Nodes="@_nodes">
6+
</SfDiagramComponent>
77

88
@code
99
{
10-
//Reference the diagram
11-
private SfDiagramComponent Diagram;
12-
//Intialize the diagram connector's collection
13-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
14-
//Intialize the diagram node's collection
15-
private DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
10+
//Reference the diagram.
11+
private SfDiagramComponent _diagram;
12+
//Initialize the diagram's connectors collection
13+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
14+
//Initialize the diagram's nodes collection
15+
private DiagramObjectCollection<Node> _nodes = new DiagramObjectCollection<Node>();
1616

1717
protected override void OnInitialized()
1818
{
19-
nodes = new DiagramObjectCollection<Node>()
20-
{
21-
new Node()
22-
{
19+
_nodes = new DiagramObjectCollection<Node>()
20+
{
21+
new Node()
22+
{
2323
OffsetX = 100,
2424
OffsetY = 100,
2525
Height = 50,
2626
Width = 100,
2727
ID = "node1",
28-
},
28+
},
2929
};
30-
Connector Connector = new Connector()
30+
var connector = new Connector()
3131
{
3232
ID = "connector1",
3333
SourcePoint = new DiagramPoint()
@@ -53,7 +53,7 @@
5353
StrokeWidth = 1
5454
},
5555
};
56-
connectors.Add(Connector);
56+
_connectors.Add(connector);
5757
}
5858

5959
// To notify the connection changing event before the connection change.

Diagram/Server/Pages/Connectors/Events/ConnectorCreating.razor

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent Height="600px" Connectors="@connectors" ConnectorCreating="OnConnectorCreating" />
5+
<SfDiagramComponent Height="600px"
6+
Connectors="@_connectors"
7+
ConnectorCreating="OnConnectorCreating" />
68

79
@code
810
{
911
// Define the connector collection.
10-
private DiagramObjectCollection<Connector> connectors;
12+
private DiagramObjectCollection<Connector> _connectors;
1113

1214
protected override void OnInitialized()
1315
{
14-
connectors = new DiagramObjectCollection<Connector>();
16+
_connectors = new DiagramObjectCollection<Connector>();
1517
//A connector is created and stored in the connectors collection.
16-
Connector Connector = new Connector()
18+
var connector = new Connector()
1719
{
1820
ID = "connector1",
1921
SourcePoint = new DiagramPoint()
@@ -27,12 +29,12 @@
2729
Y = 400,
2830
}
2931
};
30-
connectors.Add(Connector);
32+
_connectors.Add(connector);
3133
}
3234

33-
private void OnConnectorCreating(IDiagramObject obj)
35+
private void OnConnectorCreating(IDiagramObject args)
3436
{
35-
Connector connector = obj as Connector;
37+
Connector connector = args as Connector;
3638
connector.Style.Fill = "black";
3739
connector.Style.StrokeColor = "black";
3840
connector.Style.Opacity = 1;

Diagram/Server/Pages/Connectors/Events/MouseEnterEvent.razor

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent @ref="@Diagram" Width="100%" Height="700px" Connectors="@connectors" MouseEnter="OnMouseEnter" />
5+
<SfDiagramComponent @ref="_diagram"
6+
Width="100%"
7+
Height="700px"
8+
Connectors="@_connectors"
9+
MouseEnter="OnMouseEnter">
10+
</SfDiagramComponent>
611

7-
@code
12+
@code
813
{
9-
private SfDiagramComponent Diagram;
14+
private SfDiagramComponent _diagram;
1015
//Defines diagram's connector collection.
11-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
12-
16+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1317
protected override void OnInitialized()
1418
{
15-
Connector Connector = new Connector()
19+
var connector = new Connector()
1620
{
1721
ID = "connector1",
1822
// Set the source and target point of the connector.
@@ -21,11 +25,9 @@
2125
// Type of the connector segments.
2226
Type = ConnectorSegmentType.Straight
2327
};
24-
connectors.Add(Connector);
28+
_connectors.Add(connector);
2529
}
26-
2730
private void OnMouseEnter(DiagramElementMouseEventArgs args)
2831
{
29-
3032
}
3133
}

Diagram/Server/Pages/Connectors/Events/MouseHoverEvent.razor

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent @ref="@Diagram" Width="100%" Height="700px" Connectors="@connectors" MouseHover="OnMouseHover" />
5+
<SfDiagramComponent @ref="_diagram"
6+
Width="100%"
7+
Height="700px"
8+
Connectors="@_connectors"
9+
MouseHover="OnMouseHover">
10+
</SfDiagramComponent>
611

7-
@code
12+
@code
813
{
9-
private SfDiagramComponent Diagram;
14+
private SfDiagramComponent _diagram;
1015
//Defines diagram's connector collection.
11-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
12-
16+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1317
protected override void OnInitialized()
1418
{
15-
Connector Connector = new Connector()
19+
var connector = new Connector()
1620
{
1721
ID = "connector1",
1822
// Set the source and target point of the connector.
@@ -21,11 +25,9 @@
2125
// Type of the connector segments.
2226
Type = ConnectorSegmentType.Straight
2327
};
24-
connectors.Add(Connector);
28+
_connectors.Add(connector);
2529
}
26-
2730
private void OnMouseHover(DiagramElementMouseEventArgs args)
2831
{
29-
//Action to be performed.
3032
}
3133
}

Diagram/Server/Pages/Connectors/Events/MouseLeaveEvent.razor

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent @ref="@Diagram" Width="100%" Height="700px" Connectors="@connectors" MouseLeave="OnMouseLeave" />
5+
<SfDiagramComponent @ref="_diagram"
6+
Width="100%"
7+
Height="700px"
8+
Connectors="@_connectors"
9+
MouseLeave="OnMouseLeave">
10+
</SfDiagramComponent>
611

7-
@code
12+
@code
813
{
9-
private SfDiagramComponent Diagram;
14+
private SfDiagramComponent _diagram;
1015
//Defines diagram's connector collection.
11-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
12-
16+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1317
protected override void OnInitialized()
1418
{
15-
Connector Connector = new Connector()
19+
var connector = new Connector()
1620
{
1721
ID = "connector1",
1822
// Set the source and target point of the connector.
@@ -21,11 +25,11 @@
2125
// Type of the connector segments.
2226
Type = ConnectorSegmentType.Straight
2327
};
24-
connectors.Add(Connector);
28+
_connectors.Add(connector);
2529
}
2630

2731
private void OnMouseLeave(DiagramElementMouseEventArgs args)
2832
{
29-
//Action to be performed.
33+
3034
}
3135
}

Diagram/Server/Pages/Connectors/Events/PositionChangeEvent.razor

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent @ref="Diagram" Width="1000px" PositionChanging="@OnPositionChanging" PositionChanged="@OnPositionChanged"
6-
Height="500px" Connectors="@connectors" />
5+
<SfDiagramComponent @ref="_diagram" Width="1000px" PositionChanging="@OnPositionChanging" PositionChanged="@OnPositionChanged" Height="500px" Connectors="@_connectors">
6+
</SfDiagramComponent>
77

88
@code
99
{
10-
//Reference the diagram
11-
private SfDiagramComponent Diagram;
12-
//Initialize the diagram's connector collection
13-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
10+
//Reference the diagram.
11+
private SfDiagramComponent _diagram;
12+
//Initialize the diagram's connectors collection
13+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1414

1515
protected override void OnInitialized()
1616
{
17-
Connector Connector = new Connector()
17+
var connector = new Connector()
1818
{
1919
ID = "connector1",
2020
SourcePoint = new DiagramPoint()
@@ -44,19 +44,19 @@
4444
StrokeWidth = 1
4545
},
4646
};
47-
connectors.Add(Connector);
47+
_connectors.Add(connector);
4848
}
4949

50-
// Event to notify the position changing event before dragging the diagram elements
50+
// To notify the position changing event before dragging the diagram elements.
5151
private void OnPositionChanging(PositionChangingEventArgs args)
5252
{
53-
//sets true to cancel the dragging.
53+
//Sets true to cancel the dragging.
5454
args.Cancel = true;
5555
}
5656

57-
// Event to notify the position changed event after dragged the diagram elements.
57+
// To notify the position changed event after dragging the diagram elements.
5858
private void OnPositionChanged(PositionChangedEventArgs arg)
5959
{
60-
//Action to be performed
60+
//Action to be performed.
6161
}
6262
}

Diagram/Server/Pages/Connectors/Events/PropertyChangedEvent.razor

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent @ref="@diagram" Width="100%" Height="700px" Connectors="@connectors" PropertyChanged="OnNodePropertyChanged" />
5+
<SfDiagramComponent @ref="_diagram"
6+
Width="100%"
7+
Height="700px"
8+
Connectors="@_connectors"
9+
PropertyChanged="OnNodePropertyChanged">
10+
</SfDiagramComponent>
611

712
@code
813
{
9-
private SfDiagramComponent diagram;
14+
private SfDiagramComponent _diagram;
1015
//Defines diagram's connector collection.
11-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
12-
16+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1317
protected override void OnInitialized()
1418
{
15-
Connector Connector = new Connector()
19+
var connector = new Connector()
1620
{
1721
ID = "connector1",
1822
// Set the source and target point of the connector.
@@ -21,9 +25,8 @@
2125
// Type of the connector segments.
2226
Type = ConnectorSegmentType.Straight
2327
};
24-
connectors.Add(Connector);
28+
_connectors.Add(connector);
2529
}
26-
2730
// Method to handle Property Changed event
2831
private void OnNodePropertyChanged(PropertyChangedEventArgs args)
2932
{

Diagram/Server/Pages/Connectors/Events/SegmentCollectionChangeEvent.razor

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent Height="600px" Connectors="@connectors" SegmentCollectionChange="SegmentCollectionChange" />
5+
<SfDiagramComponent Height="600px"
6+
Connectors="@_connectors"
7+
SegmentCollectionChange="SegmentCollectionChange" />
68

79
@code
810
{
911
// Define the connector collection.
10-
private DiagramObjectCollection<Connector> connectors;
12+
private DiagramObjectCollection<Connector> _connectors;
1113

1214
protected override void OnInitialized()
1315
{
14-
connectors = new DiagramObjectCollection<Connector>();
16+
_connectors = new DiagramObjectCollection<Connector>();
1517
//A connector is created and stored in the connectors collection.
16-
Connector Connector = new Connector()
18+
var connector = new Connector()
1719
{
1820
ID = "connector1",
1921
SourcePoint = new DiagramPoint()
@@ -27,7 +29,7 @@
2729
Y = 400,
2830
}
2931
};
30-
connectors.Add(Connector);
32+
_connectors.Add(connector);
3133
}
3234

3335
private void SegmentCollectionChange(SegmentCollectionChangeEventArgs args)

0 commit comments

Comments
 (0)