-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jasper De Keukelaere (imec)
authored and
Jasper De Keukelaere (imec)
committed
Dec 10, 2024
1 parent
e09c585
commit 41f1d69
Showing
22 changed files
with
1,196 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
@using Blazor.Diagrams | ||
@using Blazor.Diagrams.Core | ||
@using Blazor.Diagrams.Core.PathGenerators | ||
@using Blazor.Diagrams.Core.Routers | ||
@using Blazor.Diagrams.Options | ||
@using Blazor.Diagrams.Components | ||
@using Blazor.Diagrams.Components.Widgets | ||
@using Blazor.Diagrams.Core.Geometry | ||
@using Blazor.Diagrams.Core.Models | ||
@using PLCsimAdvanced_Manager.Services.Nodegraph | ||
@using PLCsimAdvanced_Manager.Services.Nodegraph.InputNode | ||
@using PLCsimAdvanced_Manager.Services.Nodegraph.OutputNode | ||
@inject NodegraphServiceFactory NodegraphServiceFactory | ||
|
||
<div class="diagram-container @(simulationRunning ? "border-yellow" : "")"> | ||
<CascadingValue Value="Diagram" IsFixed="true"> | ||
<DiagramCanvas> | ||
<Widgets> | ||
<SelectionBoxWidget/> | ||
</Widgets> | ||
|
||
</DiagramCanvas> | ||
</CascadingValue> | ||
|
||
<MudButton @onclick="_nodegraphService.ExecuteSimulation" Disabled="simulationRunning">Start simulation</MudButton> | ||
<MudButton @onclick="_nodegraphService.StopSimulation" Disabled="!simulationRunning">Stop simulation</MudButton> | ||
|
||
@if (simulationRunning) | ||
{ | ||
<MudText>Stop simulation to change nodegraph</MudText> | ||
} | ||
else | ||
{ | ||
<MudTabs Elevation="2" Rounded="true" ApplyEffectsToContainer="true" PanelClass="pa-6"> | ||
|
||
<MudTabPanel Text="Datablocks"> | ||
<VariablesTable Area="EArea.DataBlock" InstanceName="@InstanceName" Diagram="Diagram"></VariablesTable> | ||
</MudTabPanel> | ||
<MudTabPanel Text="Inputs"> | ||
<VariablesTable Area="EArea.Input" InstanceName="@InstanceName" Diagram="Diagram"></VariablesTable> | ||
|
||
</MudTabPanel> | ||
<MudTabPanel Text="Outputs"> | ||
<VariablesTable Area="EArea.Output" InstanceName="@InstanceName" Diagram="Diagram"></VariablesTable> | ||
</MudTabPanel> | ||
</MudTabs> | ||
} | ||
</div> | ||
|
||
|
||
@code { | ||
|
||
[Parameter] public string InstanceName { get; set; } | ||
|
||
private NodegraphService _nodegraphService; | ||
private BlazorDiagram Diagram; | ||
|
||
private bool simulationRunning; | ||
|
||
|
||
protected override void OnInitialized() | ||
{ | ||
_nodegraphService = NodegraphServiceFactory.GetOrCreateService(InstanceName); | ||
Diagram = _nodegraphService.Diagram; | ||
_nodegraphService.OnSimulationStarted += OnSimulationStarted; | ||
_nodegraphService.OnSimulationStopped += OnSimulationStopped; | ||
simulationRunning = _nodegraphService.IsSimulationRunning; | ||
} | ||
|
||
private void OnSimulationStarted(object sender, EventArgs e) | ||
{ | ||
simulationRunning = true; | ||
StateHasChanged(); | ||
} | ||
|
||
private void OnSimulationStopped(object sender, EventArgs e) | ||
{ | ||
simulationRunning = false; | ||
StateHasChanged(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.diagram-container{ | ||
width: 100%; | ||
height: 400px; | ||
border: 1px solid lightgray; | ||
} | ||
|
||
.diagram-container.border-yellow { | ||
border: 4px solid #ff8400; | ||
} |
Oops, something went wrong.