Пример #1
0
        private void HandleContactClicked(UserViewModel uvm)
        {
            AppShell.Current.Navigate(typeof(ProfileDetails), uvm);

        }
Пример #2
0
        internal static UserViewModel MergeFromSharepoint(UserViewModel userViewModel, SPItemUser u)
        {
            userViewModel.DocId = u.DocId;
            userViewModel.Department = u.Department;
            userViewModel.JobTitle = u.JobTitle;
            userViewModel.Path = u.Path;
            userViewModel.WorkEmail = u.WorkEmail;
            if (!String.IsNullOrEmpty(u.PictureUrl))
                userViewModel.SPPictureUrl = new BitmapImage(new Uri(u.PictureUrl));
            else
                userViewModel.SPPictureUrl = ImageHelper.UnknownPersonImage;

            userViewModel.Name = u.PreferredName;
            userViewModel.FirstName = u.FirstName;

            if (string.IsNullOrEmpty(userViewModel.UserPrincipalName))
                userViewModel.UserPrincipalName = u.UserName.Trim() ;

            userViewModel.IsLoadedFromSharePoint = true;

            return userViewModel;
        }
Пример #3
0
 static UserViewModel()
 {
     empty = new UserViewModel();
     empty.IsLoadedFromGraph = true;
     empty.IsLoadedFromSharePoint = true;
     uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
 }
Пример #4
0
        internal static UserViewModel GetUser(string userPrincipalName)
        {
            userPrincipalName = userPrincipalName.Trim();
            try
            {
                if (string.IsNullOrEmpty(userPrincipalName))
                    return UserViewModel.Empty;

                UserViewModel user = users.FirstOrDefault(u => u.Email == userPrincipalName || u.UserPrincipalName == userPrincipalName);


                if (user != null)
                    return user;

                user = new UserViewModel()
                {
                    Email = userPrincipalName,
                    UserPrincipalName = userPrincipalName,
                    IsLoadedFromGraph = false,
                };

                users.Add(user);
                return user;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                throw;
            }

        }
Пример #5
0
        public ProfileViewModel(UserViewModel user)
        {
            this.user = user;
            // get trendings from cache manager
            this.cacheTrendings = CacheManager<SPItemDoc>.Get(user.Email);
            // get files from cache manager
            this.cacheDriveItems = CacheManager<SPItemDoc>.Get(user.Email);
            // get files from cache manager
            this.cacheSharedItems = CacheManager<SPItemDoc>.Get(user.Email);

            this.DriveItems = new ObservableCollection<DriveItemViewModel>();
            this.Trendings = new ObservableCollection<DriveItemViewModel>();
            this.SharedItems = new ObservableCollection<DriveItemViewModel>();
            this.TeamWork = new ObservableCollection<UserViewModel>();
        }