public async Task AddMoreInformation(string friendlyName, int maxSpace) { ShowText = "Creating new user..."; var user = await UserService.Instance.CreateUser(friendlyName, maxSpace); if (user != null) { File.WriteAllText(_fileName, JsonConvert.SerializeObject(user)); ShowText = "Signing in..."; UserService.Instance.SetCurrentUser(user); IsBusy = false; CanContinueEvent?.Invoke(); return; } throw new OperationFailedException("User creation failed."); }
public void LoadUser() { ShowText = "Getting user details..."; IsBusy = true; if (!File.Exists(_fileName)) { MoreInformationNeeded?.Invoke(); return; } var text = File.ReadAllText(_fileName); var currentUser = JsonConvert.DeserializeObject <UserDto>(text); ShowText = "Signing in..."; UserService.Instance.SetCurrentUser(currentUser); //await Task.Delay(10); CanContinueEvent?.Invoke(); //return Task.CompletedTask; }