예제 #1
0
        void OnLinkClick(object sender, RoutedEventArgs e)
        {
            TreeViewItem thisItem = (TreeViewItem)sender;
            ILIASCourse  course   = (ILIASCourse)thisItem.DataContext;

            System.Diagnostics.Process.Start(course.guid.Replace("amp;", ""));
        }
예제 #2
0
        public override bool Equals(object Obj)
        {
            ILIASCourse other = (ILIASCourse)Obj;

            return(this.title == other.title &&
                   this.link == other.link &&
                   this.description == other.description &&
                   this.pubDate == other.pubDate &&
                   this.guid == other.guid);
        }
예제 #3
0
        /// <summary>
        /// XDocument to ILIASCourse parser.
        /// </summary>
        /// <param name="doc">XDocument that contains the xml doc.</param>
        /// <returns></returns>
        private List <ILIASCourse> XDocToILIASCourseList(XDocument doc)
        {
            List <ILIASCourse> courseList = new List <ILIASCourse>();

            foreach (var element in doc.Descendants("item"))
            {
                ILIASCourse course = new ILIASCourse();

                foreach (var node in element.Nodes())
                {
                    if (node.ToString().StartsWith("<title>"))
                    {
                        course.title = node.ToString().Replace("<title>", "").Replace("</title>", "");
                    }
                    else if (node.ToString().StartsWith("<guid>"))
                    {
                        course.guid = node.ToString().Replace("<guid>", "").Replace("</guid>", "");
                        ;
                    }
                    else if (node.ToString().StartsWith("<link>"))
                    {
                        course.link = node.ToString().Replace("<link>", "").Replace("</link>", "");
                        ;
                    }
                    else if (node.ToString().StartsWith("<pubDate>"))
                    {
                        course.pubDate = node.ToString().Replace("<pubDate>", "").Replace("</pubDate>", "");
                        ;
                    }
                    else if (node.ToString().StartsWith("<description>"))
                    {
                        course.description = node.ToString().Replace("<description>", "").Replace("</description>", "");
                        ;
                    }
                }

                courseList.Add(course);
            }
            return(courseList);
        }