Ejemplo n.º 1
0
        /// <summary>
        /// Asynchronous web api call to update the array of courses.
        /// </summary>
        /// <param name="c"></param>
        public void UpdateCourses()
        {
            List <ProfileCourse> c = null;

            //web api call to collect courses
            try
            {
                var task = AsyncServiceClient.GetCoursesForUser(m_authtoken);
                c = task.Result;
            }

            catch (Exception e)
            {
                //TODO: Handle unknown exception
            }


            //set courses to the web api result converted to an array
            if (c == null)
            {
                m_courses = null;
            }
            else
            {
                m_courses = c.ToArray();
            }
        }
Ejemplo n.º 2
0
        private async void GetCoursesForUserAsync(string authToken)
        {
            var task    = AsyncServiceClient.GetCoursesForUser(authToken);
            var courses = await task;

            Courses.Clear();
            foreach (var course in courses.OfType <ICourse>())
            {
                Courses.Add(course);
            }

            IsLoading = false;
        }