Пример #1
0
        private void Run()
        {
            XmlDocument doc = new XmlDocument();

            foreach (string xmlFilename in _xmlFilenames)
            {
                doc.Load(xmlFilename);

                XmlElement elem = doc.DocumentElement;
                Dictionary <string, Channel> channels = new Dictionary <string, Channel>();

                if (elem.Name == "tv")
                {
                    foreach (XmlNode node in elem.ChildNodes)
                    {
                        if (node.Name == "channel")
                        {
                            Channel ch = new Channel();
                            ch.id   = node.Attributes["id"].Value;
                            ch.name = node["display-name"].InnerText;
                            channels.Add(ch.id, ch);
                            _channels.Add(ch);
                        }
                        else if (node.Name == "programme")
                        {
                            Programme pr   = new Programme();
                            string    chid = node.Attributes["channel"].Value;
                            pr.channel   = channels[chid];
                            pr.startTime = ParseDateTime(node.Attributes["start"].Value);
                            pr.stopTime  = ParseDateTime(node.Attributes["stop"].Value);

                            pr.title = node["title"].InnerText;
                            if (node["desc"] != null)
                            {
                                pr.desc = node["desc"].InnerText;
                            }
                            if (node["category"] != null)
                            {
                                pr.category = node["category"].InnerText;
                            }
                            if (node["rating"] != null)
                            {
                                if (node["rating"]["value"] != null)
                                {
                                    pr.rating = node["rating"]["value"].InnerText;
                                }
                            }

                            _programmes.Add(pr);
                        }
                    }
                }
            }

            this.Invoke(new MethodInvoker(this.RefreshChannels));
            this.Invoke(new MethodInvoker(this.RefreshView));
        }
Пример #2
0
        void lb_MouseEnter(object sender, EventArgs e)
        {
            Label     lb = sender as Label;
            Programme pr = lb.Tag as Programme;

            if (lb != null)
            {
                TimeSpan duration = pr.stopTime.Subtract(pr.startTime);
                textBox1.Text  = pr.startTime.ToLocalTime().ToString("h:mm:ss tt") + "  " + duration.ToString() + "\r\n";
                textBox1.Text += pr.title + "   (" + pr.category + ")\r\n";
                textBox1.Text += pr.desc + "\r\n";
            }
        }