Sorry, there's nothing at this address.
10 |Current count: @currentCount
6 | 7 | 8 | 9 | @code { 10 | private int currentCount = 0; 11 | 12 | private void IncrementCount() 13 | { 14 | currentCount++; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BookServer/Pages/Error.razor: -------------------------------------------------------------------------------- 1 | @page "/error" 2 | 3 | 4 |9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |
11 |12 | The Development environment shouldn't be enabled for deployed applications. 13 | It can result in displaying sensitive information from exceptions to end users. 14 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 15 | and restarting the app. 16 |
-------------------------------------------------------------------------------- /BookServer/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 |This component demonstrates fetching data from a service.
6 | 7 | @if (forecasts == null) 8 | { 9 |Loading...
10 | } 11 | else 12 | { 13 |Date | 17 |Temp. (C) | 18 |Temp. (F) | 19 |Summary | 20 |
---|---|---|---|
@forecast.Date.ToShortDateString() | 27 |@forecast.TemperatureC | 28 |@forecast.TemperatureF | 29 |@forecast.Summary | 30 |
Browser has GeoLocation
10 | } 11 | 12 | @if (position != null) 13 | { 14 |Current position: @position.Coords.Latitude Lat, @position.Coords.Longitude Long
15 |Position reported at: @position.Timestamp
16 | } 17 | 18 | @switch (error) 19 | { 20 | case PositionError.PERMISSION_DENIED: 21 |GeoLocation Permisson Denied
22 | break; 23 | case PositionError.POSITION_UNAVAILABLE: 24 |GeoLocation Position Unavailable
25 | break; 26 | case PositionError.TIMEOUT: 27 |GeoLocation Timeout
28 | break; 29 | default: 30 | break; 31 | } 32 | 33 | @code { 34 | Position position; 35 | PositionError error; 36 | bool hasGeoLocation; 37 | 38 | void OnSuccess(Position p) { 39 | position = p; 40 | StateHasChanged(); 41 | } 42 | 43 | void OnError(PositionError e) { 44 | error = e; 45 | StateHasChanged(); 46 | } 47 | 48 | protected override async Task OnAfterRenderAsync(bool firstRender) 49 | { 50 | if (firstRender) 51 | { 52 | var geo = new Geolocation(js); 53 | hasGeoLocation = await geo.HasGeolocationFeature(); 54 | StateHasChanged(); 55 | 56 | var options = new PositionOptions() { EnableHighAccuracy = false, Timeout = 200, MaximumAge = 0 }; 57 | await geo.GetCurrentPosition(OnSuccess, OnError, options); 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /BookServer/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |See source code to toggle the key attribute.
4 | 5 |7 | @Summary weather expected @DayOfWeek 8 |
9 |