public UserAccountPage() { this.InitializeComponent(); DJISDKManager.Instance.UserAccountManager.UserAccountStateChanged += UserAccountManager_UserAccountStateChanged; accountState = DJISDKManager.Instance.UserAccountManager.UserAccountState; }
private async void UserAccountManager_UserAccountStateChanged(UserAccountState state, SDKError error) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { accountState = state; operationResTextBlock.Text = error.ToString(); }); }
public async Task RegisterUser(UserAccountState userAccount) { if (_account.State.Equals(null)) { throw new System.Exception("User Already Registered."); } _account.State = userAccount; await _account.WriteStateAsync(); }
public async void CanCreateAccount() { // Create a user under that user hash account that resides on for example Auth0. var account = cluster.GrainFactory.GetGrain <IUserAccountPersistentGrain>("live|1234567890"); // Register A User Account var user = new UserAccountState() { Email = "*****@*****.**", Name = "unittest", Locale = new System.Globalization.CultureInfo("nl-NL"), NickName = "unittestnick", Picture = new System.Uri("https://somegravatar.com/4438439") }; await account.RegisterUser(user); // For an advanced example usage see: PubSubTest, where a user is connected as an owner for a piece of content. var accountRetrieval = cluster.GrainFactory.GetGrain <IUserAccountPersistentGrain>("live|1234567890"); Assert.Equal(user.Email, accountRetrieval.GetUserAccountInfo().Result.Email); }
private async Task CreateUserAccountsAsync(User user) { _userAccountCrud.AppDbContext = AppDbContext; UserAccountState userAccountActiveState = await AppDbContext .FindGenericElementByIdAsync <UserAccountState>((long)UserAccountStates.Active); List <UserAccountType> userAccountTypes = await AppDbContext .Set <UserAccountType>() .ToListAsync(); foreach (UserAccountType accountType in userAccountTypes) { UserAccount userAccount = new UserAccount { UserOwner = user, State = userAccountActiveState, Type = accountType }; await _userAccountCrud.CreateFromEntityAsync(userAccount); } }