JensKrumsieck/ChemSharp

View on GitHub
ChemSharp.Molecules.Blazor/BlazorAtom.cs

Summary

Maintainability
A
0 mins
Test Coverage
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;

namespace ChemSharp.Molecules.Blazor;

public class BlazorAtom : ComponentBase
{
    [Parameter] public Atom? Atom { get; set; }

    [Inject] public IJSRuntime JS { get; set; }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (Atom == null) return;

        await JS.InvokeVoidAsync("chemsharpMolecules.addAtom", Atom.Title, Atom.Symbol,
                                 Atom.Location.X, Atom.Location.Y, Atom.Location.Z,
                                 Atom.CovalentRadius, Atom.Color);
    }
}