public async Task SetModeAsync(TimeFormatterMode mode)
        {
            await _localStorage.SetAsync(_storageKey, mode.ToString());

            Mode = mode;
            ModeChanged?.Invoke();
        }
Example #2
0
        public async Task LoginAsync(string token)
        {
            if (_feedRefreshCancellToken != null)
            {
                _feedRefreshCancellToken.Cancel();
            }

            var user = await _api.LoginAsync(token);

            await _localStorage.SetAsync(LOCAL_USER_LOCAL_STORAGE_KEY, Token = user.Token);

            Feeds = user.Feeds;
            var cancelToken = _feedRefreshCancellToken = new CancellationTokenSource();

            _ = Task.Run(async() =>
            {
                while (!cancelToken.IsCancellationRequested)
                {
                    foreach (var feed in user.Feeds)
                    {
                        if (cancelToken.IsCancellationRequested)
                        {
                            break;
                        }
                        await _feedService.RefreshFeedAsync(feed);
                    }
                    await Task.Delay(TimeSpan.FromMinutes(10), cancelToken.Token);
                }
            });
        }
Example #3
0
        protected async void TempSave()
        {
            await LocalStorageService.SetAsync("Employee", Employee);

            NavigationManager.NavigateTo("/employeeoverview");
        }