Пример #1
0
        public async Task ReturnsTrue_When_KeyExistsInStore()
        {
            // Arrange
            const string key   = "TestKey";
            var          item1 = new TestObject(1, "Jane Smith");
            await _sut.SetItemAsync(key, item1);

            // Act
            var containsKey = await _sut.ContainKeyAsync(key);

            // Assert
            Assert.True(containsKey);
        }
Пример #2
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (firstRender)
            {
                if (await LocalStorageService.ContainKeyAsync("PrefferedOsobaId"))
                {
                    this.PrefferedOsobaId = await LocalStorageService.GetItemAsync <int>("PrefferedOsobaId");
                }
            }
        }
Пример #3
0
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            if (!(await LocalStorageService.ContainKeyAsync("UserData")))
            {
                NavigationManager.NavigateTo("/Login");
            }
            else
            {
                Dispatcher.Dispatch(new LoginAction()
                {
                    UserName = "******", Password = "******", ServerUrl = "https://api.budgetari.net/api"
                });
            }
            NavigationManager.LocationChanged += NavigationManager_LocationChanged;
        }
Пример #4
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (firstRender)
            {
                DateTime lastVisit = DateTime.Today.AddDays(-14);
                if (await LocalStorageService.ContainKeyAsync("LastVisit"))                 // JS Interop - musíme až do AfterRender
                {
                    lastVisit = await LocalStorageService.GetItemAsync <DateTime>("LastVisit");
                }

                if ((await NastenkaWebApiClient.GetVzkazyAsync()).Vzkazy.Any(vzkaz => vzkaz.DatumVlozeni > lastVisit))
                {
                    ShowNastenkaLink = true;
                    StateHasChanged();
                }

                await LocalStorageService.SetItemAsync("LastVisit", DateTime.Now);

                await JSRuntime.InvokeVoidAsync("setTitle", "Volejbal - Přihlašování");
            }
        }