Пример #1
0
 private async void Service_OnTelemetryArrived(object sender, TransportLocationData e)
 {
     if (!canRunJs)
     {
         return;
     }
     await ClientRuntime.InvokeVoidAsync("telemetryArrived", new[] { e });
 }
Пример #2
0
        public async Task RouteChecked(SubscriptionModel route)
        {
            await Task.Delay(42);

            Service.OnSubscriptionListChanged.Invoke(route);
            await ClientRuntime.InvokeVoidAsync("handleActiveRoutes", new[] { ActiveSubscriptions() });

            await LocalStorage.SetItemAsync("all", ActiveSubscriptions());
        }
Пример #3
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (!firstRender)
            {
                return;
            }
            var routesFromClient = await LocalStorage.GetItemAsync <SubscriptionModel[]>("all") ?? Enumerable.Empty <SubscriptionModel>();

            var realObjects = routesFromClient.ToDictionary(h => h, h => Subscriptions.FirstOrDefault(f => f.Equals(f, h)));

            realObjects.ToList().ForEach(async(x) =>
            {
                // PATCH, make runtime object properties like in saved from localstorage
                x.Value.IsActive = x.Key.IsActive;
                await RouteChecked(x.Value);
            });
            canRunJs = true;

            await ClientRuntime.InvokeVoidAsync("initMap");

            StateHasChanged();
        }