Пример #1
0
        protected override async Task OnInitializedAsync()
        {
            ThingPaginationFilter paginationFilter = new ThingPaginationFilter();

            paginationFilter.Type = ThingType.EnergyMonitor;

            var result = await IoTSuiteService.GetThings(paginationFilter);

            things            = result.Data;
            thingsPlaceholder = "Choose a Thing";

            await InvokeAsync(StateHasChanged);

            hubConnection = new HubConnectionBuilder()
                            .WithUrl(UriHelper.ToAbsoluteUri("/Hub/SignalR"), options =>
            {
                options.AccessTokenProvider = async() =>
                {
                    var tokenResult = await TokenProvider.RequestAccessToken();

                    if (tokenResult.TryGetToken(out var token))
                    {
                        return(await Task.FromResult(token.Value));
                    }
                    else
                    {
                        return(await Task.FromResult(string.Empty));
                    }
                };
Пример #2
0
        protected async Task FormSubmit(Position args)
        {
            try
            {
                await IoTSuiteService.UpdatePosition(args);

                DialogService.Close(args);
            }
            catch
            {
                NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to update Position");
            }
        }
Пример #3
0
        protected async Task FormSubmit(PowerMeterInstantaneous args)
        {
            try
            {
                await IoTSuiteService.UpdatePowerMeter(args);

                DialogService.Close(args);
            }
            catch
            {
                NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to update PowerMeter");
            }
        }
Пример #4
0
 protected override async Task OnInitializedAsync()
 {
     data = (await IoTSuiteService.GetPosition(Id)).Data;
 }
Пример #5
0
 protected override async Task OnInitializedAsync()
 {
     powerMeterInstantaneous = (await IoTSuiteService.GetPowerMeter(Id)).Data;
 }