Exemplo n.º 1
0
        /// <summary>
        /// Updates the two avatar images for the current user
        /// </summary>
        /// <param name="overrideUser">An optional, explicit user to load instead of the default one</param>
        /// <param name="blur">The amount of blur to use</param>
        protected async Task TryLoadUserAvatarImagesAsync([CanBeNull] User overrideUser = null, int blur = 128)
        {
            // Pick the target user to load
            User candidate = overrideUser ?? User;

            if (candidate == null)
            {
                return;
            }

            // Update the images
            CancellationTokenSource          cts    = new CancellationTokenSource(TimeSpan.FromSeconds(5));
            Tuple <ImageSource, ImageSource> images = await UserUtility.GetDeveloperAvatarOptionsAsync(candidate, blur, cts.Token);

            UserAvatar        = images?.Item1;
            UserBlurredAvatar = images?.Item2;
        }