/// <summary>
        ///  Method will try to obtain a user from a database with name provided in username textbox
        /// </summary>
        private async void GetUser()
        {
            string username = editUsername.Text;

            var task = DatabaseManager.GetUser(username);

            Plugin.CloudFirestore.IQuerySnapshot snapshot = await task.ConfigureAwait(false);

            Instance.User = snapshot.ToObjects <UserProfile>().FirstOrDefault();
        }
Пример #2
0
        /// <summary>
        /// Load User data from firestore.
        /// Loaded items are user profile and user groups, as wll as documents Ids for loaded documents
        /// </summary>
        /// <param name="email">email address</param>
        internal static async Task <IQuerySnapshot> LoadUserData(string email)
        {
            var task = DatabaseManager.GetUser(email);

            Plugin.CloudFirestore.IQuerySnapshot snapshot = await task.ConfigureAwait(false);

            Instance.User = snapshot.ToObjects <UserProfile>().FirstOrDefault();

            snapshot = await DatabaseManager.GetUserGroups(User)
                       .ConfigureAwait(false);

            Instance.UserGroups = snapshot.ToObjects <UserGroups>().FirstOrDefault();

            //TODO: This will add only if user is not attending
            //snapshot = await DatabaseManager.GetSportEvents(User)
            //    .ConfigureAwait(false);

            //Instance.Events = snapshot.ToObjects<SportEvent>().ToList();
            return(snapshot);
        }