Skip to content

Commit

Permalink
Merge branch 'dev' into tia-time-format
Browse files Browse the repository at this point in the history
  • Loading branch information
PTKu authored Jan 27, 2024
2 parents cde3648 + e276233 commit 020d382
Show file tree
Hide file tree
Showing 77 changed files with 5,002 additions and 482 deletions.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Thanks!

Thank you for considering contributing to this project. This document will help you to get started and guide you through the process. Industrial automation has developed very limited culture of open-souce development. The most important is to get started and enjoy the wave of endorfins once your pull request is approved. It does not have to be anything big, maybe just typo in the documentation, question or idea to discuss.
Thank you for considering contributing to this project. This document will help you to get started and guide you through the process. Industrial automation has developed a minimal culture of open-source development. The most important is to get started and enjoy the wave of endorphins once your pull request is approved. It does not have to be anything significant, a typo in the documentation, question, or idea to discuss.

# Contributing

When contributing to this repository, please first discuss the change you wish to make via [issue](https://github.com/ix-ax/axsharp/issues) or open a [discussion](https://github.com/ix-ax/axsharp/discussions).

**IMPORTANT!!!** If you discover a **security issue do not disclose that information** in public spaces of the repo (issues, discussions), more info [here](SECURITY.md).
**IMPORTANT!!!** If you discover a **security issue, do not disclose that information** in public spaces of the repo (issues, discussions), more info [here](SECURITY.md).

## Before you contribute

- Your contributions are under MIT license.
- Make sure you work with tools and versions listed in the [pre-requisites](docs/articles/general/REQUISITES.md).
- Use consistent coding style, find more info in [coding style document](docs/articles/general/CODING_STYLE.md) of this project.
- Make sure you work with tools and versions listed in the [pre-requisites](docfx/index.md#prerequisites).
- Use consistent coding style, find more info in [coding style document](docfx/articles/general/CODING_STYLE.md) of this project.
- All changes happen via pull requests.
- Additions or changes to the code should contain [in-code documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/documentation-comments) .
- Additions or changes should be reflected in how-to and readme documentation.
Expand All @@ -21,5 +21,5 @@ When contributing to this repository, please first discuss the change you wish t
## Pull Request Process

1. Ensure any install or build dependencies are removed before requesting approval.
1. Describe the change in the PR use this [template](.github/PULL_REQUEST_TEMPLATE/pull_request_template.md) if applicable.
1. Describe the change in the PR use this [template](.github/pull_request_template.md#description) if applicable.
1. Pull requests will be reviewed and merged by repository maintainers.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ AX# is in development; we will address the security issues in the latest pre-rel
## Reporting a Vulnerability

**Please do not disclose the vulnerability in the publicly available parts of this repo.**
The vulnerabilities should be reported to the following email mts@mts.sk
The vulnerabilities should be reported to the following email team@axsharp.com
We will address the security issue in a separate workflow.

1 change: 1 addition & 0 deletions docfx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The presentations provide a mechanism for automated UI generation from PLC code.
- [axcode](https://axcite.me)
- [dotnet 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
- [dotnet 7](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
- [dotnet 7](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- [vscode](https://code.visualstudio.com/Download) or [vs2022](https://visualstudio.microsoft.com/vs/)

> **Make sure you have installed both .NET6 and .NET7.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\AXSharp.connectors\src\AXSharp.Connector\AXSharp.Connector.csproj" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>Full</DebugType>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AXSharp.Presentation.Blazor\AXSharp.Presentation.Blazor.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
</ItemGroup>

<ItemGroup>
<Folder Include="wwwroot\css\" />
<Folder Include="wwwroot\js\" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\AXSharp.Presentation.Blazor\AXSharp.Presentation.Blazor.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,27 @@ public T Component
get => _component;
set
{
_component = value;
if (_component == null)
{
_component = value;
this.OnComponentChanged();
return;
}

if (_component != null && !_component.Equals(value))
{
_component = value;
this.OnComponentChanged();
}
}
}

/// <summary>
/// Method called when the component (the context component of this rcc) is changed.
/// </summary>
public virtual void OnComponentChanged()
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ namespace AXSharp.Presentation.Blazor.Controls.RenderableContent
/// </summary>
public partial class RenderableComponentBase : ComponentBase, IRenderableComponent, IDisposable
{
[Parameter] public int PollingInterval { get; set; }
/// <summary>
/// Gets or sets the RenderableContentControl that encapsulates this component.
/// </summary>
[Parameter]
public object RccContainer { get; set; } = new Object();

[Parameter] public int PollingInterval { get; set; } = 250;

/// <summary>
/// Disposes this object as well as communication resources used by this component.
Expand Down Expand Up @@ -153,17 +159,50 @@ public void UpdateValuesOnChangeOutFocus(OnlinerBase tag)

protected void HandlePropertyChanged(object sender, PropertyChangedEventArgs a)
{
InvokeAsync(StateHasChanged);
if (ShouldBeUpdated(sender as ITwinElement))
{
InvokeAsync(StateHasChanged);
}
}

protected void HandleShadowPropertyChanged(object sender, ValueChangedEventArgs a)
{
InvokeAsync(StateHasChanged);
}

protected virtual bool ShouldBeUpdated(ITwinElement element)
{
if (element == null)
return true;

var renderableContentControl = (RccContainer as RenderableContentControl);

if(renderableContentControl != null)
{
if (renderableContentControl.Context.GetParent().GetConnector().SubscriptionMode == ReadSubscriptionMode.AutoSubscribeUsedVariables)
{
return true;
}

if (renderableContentControl.Context.GetParent().GetConnector().SubscriptionMode == ReadSubscriptionMode.Polling)
{
return this.PolledElements.Contains(element);
}
}

return true;
}

protected void HandlePropertyChangedOnOutFocus(object sender, PropertyChangedEventArgs a)
{
if(!HasFocus) InvokeAsync(StateHasChanged);
if (!HasFocus)
{
if (ShouldBeUpdated(sender as ITwinElement))
{
InvokeAsync(StateHasChanged);
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
@*This class is view part of RenderableContentControl. It contains UI generation pipeline.*@

@*Call rendering method over context object*@
<div name="@_context.Symbol.Replace(".","-")" class="@Class">
@RenderComponent(_context)
</div>
@if (Context != null)
{
<div name="@Context.Symbol.Replace(".", "-")" class="@Class">
@RenderComponent(Context)
</div>
}



@code
{
private RenderFragment RenderComponent(ITwinElement element) => __builder =>
{
if (element == null)
return;

// if it is primitive type, just generate
if (element is ITwinPrimitive)
{
Expand All @@ -21,7 +27,7 @@
//try to find complex component (also try predecessors) and generate it
var twin = (ITwinObject)element;
var twinType = twin.GetType();
var component = ViewLocatorBuilder(twinType, twin, Presentation);
var component = ViewLocatorBuilder(twinType, twin, Presentation, PresentationTemplate);
if (component != null)
{
@CreateComplexComponent(twin, component)
Expand Down Expand Up @@ -140,7 +146,7 @@
{
Type mainLayout = null;

var component = ViewLocatorBuilder(twin.GetType(), twin, Presentation);
var component = ViewLocatorBuilder(twin.GetType(), twin, Presentation, PresentationTemplate);
if (component != null)
{
var name = String.IsNullOrEmpty(twin.AttributeName) ? twin.GetSymbolTail() : twin.AttributeName;
Expand Down Expand Up @@ -181,7 +187,7 @@
{
string presentationType = GetDisplayPresentationIfEmpty();
var primitiveKidType = primitiveKid.GetType();
var primitiveComponent = ViewLocatorBuilder(primitiveKidType, primitiveKid, presentationType);
var primitiveComponent = ViewLocatorBuilder(primitiveKidType, primitiveKid, presentationType, PresentationTemplate);
@CreatePrimitiveComponent(primitiveKid, primitiveComponent)
};

Expand Down
Loading

0 comments on commit 020d382

Please sign in to comment.