Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,24 @@ namespace AXSharp.Presentation.Blazor.Controls.RenderableContent
/// <summary>
/// Base class for complex componenets with only code-behind.
/// </summary>
public class RenderableComplexComponentBase<T> : RenderableComponentBase, IRenderableComplexComponentBase
public class RenderableComplexComponentBase<T> : RenderableComponentBase,
IRenderableComplexComponentBase,
IDisposable
{
[Parameter]
public T Component { get; set; }

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

protected override void OnInitialized()
{
base.OnInitialized();
(Component as ITwinElement)?.StartPolling(PollingInterval);
}

public virtual void Dispose()
{
(Component as ITwinElement)?.StopPolling();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ public void UpdateValuesOnChange(ITwinObject element)
{
if (element != null)
{
var tags = element.GetValueTags();
foreach (OnlinerBase tag in tags)
foreach (var twinPrimitive in element.RetrievePrimitives())
{
var tag = (OnlinerBase)twinPrimitive;
tag.PropertyChanged += new PropertyChangedEventHandler(HandlePropertyChanged);

}
}
}
Expand Down Expand Up @@ -98,6 +97,5 @@ protected void HandlePropertyChangedOnOutFocus(object sender, PropertyChangedEve
if(!HasFocus) InvokeAsync(StateHasChanged);
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public string Presentation
private ITwinElement _context { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();

try
{
_context = (ITwinElement)Context;
Expand All @@ -97,8 +99,6 @@ protected override void OnInitialized()
{
throw new ParameterWrongTypeRendererException(Context.GetType().ToString());
}

base.OnInitialized();
}
protected override void OnParametersSet()
{
Expand Down Expand Up @@ -375,7 +375,7 @@ private string GetDisplayPresentationIfEmpty()

public virtual void Dispose()
{
this._context?.StopPolling();
this._context?.StopPolling();
_viewModelCache.ResetCounter();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@ public async void should_read_huge()
}



output.WriteLine($"Number of items {huge.Count}");
var s = new Stopwatch();
s.Start();
await connector.ReadBatchAsync(huge);

s.Stop();

output.WriteLine($"Whole {s.ElapsedMilliseconds} | per item: {((double)(s.ElapsedMilliseconds) / ((double)huge.Count))}");

Assert.Equal(42, myBYTE.Cyclic);
Assert.True(myBOOL.Cyclic);
Assert.Equal(43, myINT.Cyclic);
Expand Down Expand Up @@ -249,7 +254,14 @@ public async void should_write_huge()
myBOOL.Cyclic = true;
myINT.Cyclic = 55;


output.WriteLine($"Number of items {huge.Count}");
var s = new Stopwatch();
s.Start();
await connector.WriteBatchAsync(huge);
s.Stop();

output.WriteLine($"Whole {s.ElapsedMilliseconds} | per item: {((double)(s.ElapsedMilliseconds) / ((double)huge.Count))}");

await connector.ReadBatchAsync(huge);

Expand Down