Skip to content

Commit 2bacf05

Browse files
authored
Apply code preferences, removed unused namespace and use tabs everywhere (#57)
1 parent 4325ff8 commit 2bacf05

97 files changed

Lines changed: 2274 additions & 2457 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/NodeDev.Blazor.MAUI/Platforms/Windows/App.xaml.cs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Microsoft.UI.Xaml;
2-
3-
// To learn more about WinUI, the WinUI project structure,
1+
// To learn more about WinUI, the WinUI project structure,
42
// and more about our project templates, see: http://aka.ms/winui-project-info.
53

64
namespace NodeDev.Blazor.MAUI.WinUI

‎src/NodeDev.Blazor/Components/DebuggerConsolePanel.razor.cs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using Microsoft.AspNetCore.Components;
22
using NodeDev.Core;
3-
using System.Diagnostics;
43
using System.Reactive.Subjects;
5-
using System.Text;
64

75

86
namespace NodeDev.Blazor.Components;
@@ -29,7 +27,7 @@ protected override void OnInitialized()
2927
base.OnInitialized();
3028

3129
RefreshRequiredDisposable = RefreshRequiredSubject.AcceptThenSample(TimeSpan.FromMilliseconds(100)).Subscribe(_ => InvokeAsync(StateHasChanged));
32-
30+
3331
GraphExecutionChangedDisposable = Project.GraphExecutionChanged.Subscribe(OnGraphExecutionChanged);
3432
}
3533

‎src/NodeDev.Blazor/Components/GraphCanvas.razor.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
using Microsoft.AspNetCore.Components;
88
using NodeDev.Blazor.DiagramsModels;
99
using NodeDev.Blazor.NodeAttributes;
10+
using NodeDev.Blazor.Services;
11+
using NodeDev.Blazor.Services.GraphManager;
1012
using NodeDev.Core;
13+
using NodeDev.Core.Class;
1114
using NodeDev.Core.Connections;
1215
using NodeDev.Core.Nodes;
1316
using NodeDev.Core.Types;
1417
using System.Numerics;
1518
using System.Reactive.Linq;
16-
using NodeDev.Core.Class;
17-
using NodeDev.Blazor.Services;
18-
using NodeDev.Blazor.Services.GraphManager;
1919

2020
namespace NodeDev.Blazor.Components;
2121

‎src/NodeDev.Blazor/DiagramsModels/GraphNodeModel.cs‎

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22
using NodeDev.Blazor.NodeAttributes;
33
using NodeDev.Core.Connections;
44
using NodeDev.Core.Nodes;
5-
using System;
6-
using System.Collections.Generic;
7-
using System.Linq;
85
using System.Numerics;
9-
using System.Text;
10-
using System.Threading.Tasks;
116

127
namespace NodeDev.Blazor.DiagramsModels
138
{
14-
public class GraphNodeModel : NodeModel
15-
{
16-
internal readonly Node Node;
9+
public class GraphNodeModel : NodeModel
10+
{
11+
internal readonly Node Node;
1712

1813
/// <summary>
1914
/// Set to true by the canvas when the user hit "f2" to edit the node name.
@@ -23,18 +18,18 @@ public class GraphNodeModel : NodeModel
2318

2419

2520
public GraphNodeModel(Node node) : base(new(node.GetOrAddDecoration<NodeDecorationPosition>(() => new(Vector2.Zero)).X, node.GetOrAddDecoration<NodeDecorationPosition>(() => new(Vector2.Zero)).Y))
26-
{
27-
Node = node;
28-
}
21+
{
22+
Node = node;
23+
}
2924

30-
public GraphPortModel GetPort(Connection connection) => Ports.OfType<GraphPortModel>().First( x=> x.Connection == connection);
25+
public GraphPortModel GetPort(Connection connection) => Ports.OfType<GraphPortModel>().First(x => x.Connection == connection);
3126

3227
internal void OnNodeExecuted(Connection exec)
3328
{
3429

3530
}
3631

37-
internal void OnConnectionPathHighlighted(Connection connection)
32+
internal void OnConnectionPathHighlighted(Connection connection)
3833
{
3934
var port = GetPort(connection);
4035

@@ -47,7 +42,7 @@ internal void OnConnectionPathHighlighted(Connection connection)
4742
}
4843
}
4944

50-
internal void OnConnectionPathUnhighlighted(Connection connection)
45+
internal void OnConnectionPathUnhighlighted(Connection connection)
5146
{
5247
var port = GetPort(connection);
5348

@@ -60,23 +55,23 @@ internal void OnConnectionPathUnhighlighted(Connection connection)
6055

6156
internal async Task OnNodeExecuting(Connection exec)
6257
{
63-
var port = GetPort(exec);
64-
65-
foreach (var link in port.Links.OfType<LinkModel>())
66-
{
67-
if(!link.Classes.Contains("executing"))
68-
link.Classes += " executing";
69-
70-
link.Refresh();
71-
}
72-
73-
var currentCount = ++port.ExecutionCount;
74-
await Task.Delay(100);
75-
if (currentCount == port.ExecutionCount)
76-
{
77-
foreach (var link in port.Links.OfType<LinkModel>())
78-
{
79-
link.Classes = link.Classes.Replace(" executing", "");
58+
var port = GetPort(exec);
59+
60+
foreach (var link in port.Links.OfType<LinkModel>())
61+
{
62+
if (!link.Classes.Contains("executing"))
63+
link.Classes += " executing";
64+
65+
link.Refresh();
66+
}
67+
68+
var currentCount = ++port.ExecutionCount;
69+
await Task.Delay(100);
70+
if (currentCount == port.ExecutionCount)
71+
{
72+
foreach (var link in port.Links.OfType<LinkModel>())
73+
{
74+
link.Classes = link.Classes.Replace(" executing", "");
8075
link.Refresh();
8176
}
8277
}

‎src/NodeDev.Blazor/DiagramsModels/GraphPortModel.cs‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55

66
namespace NodeDev.Blazor.DiagramsModels;
77

8-
public class GraphPortModel: PortModel
8+
public class GraphPortModel : PortModel
99
{
10-
internal readonly Connection Connection;
10+
internal readonly Connection Connection;
1111

12-
internal int ExecutionCount = 0;
12+
internal int ExecutionCount = 0;
1313

14-
internal string PortColor => GraphCanvas.GetTypeShapeColor(Connection.Type, Connection.Parent.TypeFactory);
14+
internal string PortColor => GraphCanvas.GetTypeShapeColor(Connection.Type, Connection.Parent.TypeFactory);
1515

16-
public GraphPortModel(GraphNodeModel parent, Connection connection, bool isInput) : base(parent, isInput ? PortAlignment.Left : PortAlignment.Right)
17-
{
18-
Connection = connection;
19-
}
16+
public GraphPortModel(GraphNodeModel parent, Connection connection, bool isInput) : base(parent, isInput ? PortAlignment.Left : PortAlignment.Right)
17+
{
18+
Connection = connection;
19+
}
2020

21-
public override bool CanAttachTo(ILinkable other)
22-
{
23-
if(!base.CanAttachTo(other))
24-
return false;
21+
public override bool CanAttachTo(ILinkable other)
22+
{
23+
if (!base.CanAttachTo(other))
24+
return false;
2525

26-
if (other is not GraphPortModel otherPort)
27-
return false;
28-
29-
if(Alignment == otherPort.Alignment) // can't plug input to input or output to output
30-
return false;
26+
if (other is not GraphPortModel otherPort)
27+
return false;
3128

32-
return Connection.Type.IsAssignableTo(otherPort.Connection.Type, out _, out _);
33-
}
29+
if (Alignment == otherPort.Alignment) // can't plug input to input or output to output
30+
return false;
31+
32+
return Connection.Type.IsAssignableTo(otherPort.Connection.Type, out _, out _);
33+
}
3434
}

‎src/NodeDev.Blazor/DiagramsModels/SmoothPathGeneratorWithDirectVertices.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ private Point GetCurvePoint(Anchor anchor, double pX, double pY, double cX, doub
9393
if (anchor is SinglePortAnchor spa)
9494
{
9595
PortAlignment portAlignment;
96-
if((isFirstInRoute && first) || (isLastInRoute && !first))
96+
if ((isFirstInRoute && first) || (isLastInRoute && !first))
9797
portAlignment = spa.Port.Alignment;
98-
else if(pX < cX)
98+
else if (pX < cX)
9999
portAlignment = PortAlignment.Right;
100100
else
101101
portAlignment = PortAlignment.Left;

‎src/NodeDev.Blazor/NodeDecorations/NodeDecorationPosition.cs‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
using NodeDev.Core.NodeDecorations;
22
using NodeDev.Core.Types;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
63
using System.Numerics;
7-
using System.Text;
84
using System.Text.Json;
9-
using System.Threading.Tasks;
105

116
namespace NodeDev.Blazor.NodeAttributes
127
{
@@ -24,7 +19,7 @@ public NodeDecorationPosition(Vector2 position)
2419

2520

2621
private record class SerializedNodeDecoration(float X, float Y);
27-
22+
2823
public string Serialize()
2924
{
3025
return JsonSerializer.Serialize(new SerializedNodeDecoration(X, Y));
@@ -36,5 +31,5 @@ public static INodeDecoration Deserialize(TypeFactory typeFactory, string Json)
3631

3732
return new NodeDecorationPosition(new(serializedNodeDecoration.X, serializedNodeDecoration.Y));
3833
}
39-
}
34+
}
4035
}

‎src/NodeDev.Blazor/Services/DebuggedPathService.cs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-

2-
using Microsoft.AspNetCore.Components;
3-
using NodeDev.Core;
1+
using NodeDev.Core;
42
using NodeDev.Core.Connections;
53
using NodeDev.Core.Nodes;
6-
using static MudBlazor.Defaults;
74

85
namespace NodeDev.Blazor.Services;
96

0 commit comments

Comments
 (0)