blob: b17caee6f483298a71ee4c4c2b28bb6cfc5193a5 [file] [log] [blame]
atraczyk49f1b572016-10-27 12:33:28 -04001#include "pch.h"
2
3#include "UserModel.h"
4
5using namespace RingClientUWP;
6
7void
8UserModel::getUserData()
9{
10 create_task(User::FindAllAsync())
11 .then([=](IVectorView<User^>^ users) {
12 for (size_t index = 0; index < users->Size; index++) {
13 auto user = users->GetAt(index);
14 if (user->AuthenticationStatus == UserAuthenticationStatus::LocallyAuthenticated &&
15 user->Type == UserType::LocalUser) {
16 User^ currentUser = user;
17 create_task(currentUser->GetPropertyAsync(KnownUserProperties::FirstName))
18 .then([=](Object^ result) {
19 firstName = safe_cast<String^>(result);
20 });
21 create_task(currentUser->GetPropertyAsync(KnownUserProperties::LastName))
22 .then([&](Object^ result) {
23 lastName = safe_cast<String^>(result);
24 });
25 }
26 }
27 });
28}