コード例 #1
0
        private void UpdatePicture()
        {
            int failedAttempts = _backend.GetFailedAttempts();
            int totalAttempts  = _backend.GetAllowedAttempts();

            if (failedAttempts >= totalAttempts)
            {
                // Show last picture
                image.Source = pictures.Last();
            }
            else
            {
                int percentage = failedAttempts / totalAttempts * 10;
                // Show the picture that matches the closest picture id from the percentage between failedAttempts and totalAttempts
                // Show the picture.
                image.Source = pictures[percentage];
            }
        }