zoukankan      html  css  js  c++  java
  • 灭顶之灾之网络电视精灵——S2 2.8

    从前,有一个神奇的东西叫做搞搞精灵

    关于他,有一段历史。

    哎呀!我去!写不下去了。

    -。-以上玩笑

    首先需求分析 

    TreeView显示两种频道 TypeA和TypeB

    所以创建三个类 ChannelBase TypeA TypeB

    然后每个频道有节目单

    节目单也因频道不同而不同 分为两种

    所以也是三个类

    Programme ProgramA ProgramB

    新建一个ChannelBase对象的list集合

    load事件

    判断快捷菜单用

    判断然后给DataGridView设置数据源

    频道父类:

    A子类

    B子类

    节目父类

    public class ChannelManager
        {
            public void Resolve(List<ChannelBase> list)
            {
                XmlDocument doc = new XmlDocument();
                doc.Load("files/FullChannels.xml");
                XmlNode root = doc.DocumentElement;
                foreach (XmlNode item in root.ChildNodes)
                {
                    if (item["channelType"].InnerText.Equals("TypeA"))
                    {
                        TypeA channel = new TypeA();
                        channel.Type = item["channelType"].InnerText;
                        channel.ChannelName = item["tvChannel"].InnerText;
                        channel.Path = item["path"].InnerText;
    
                        List<ProgramA> proList = new List<ProgramA>();
                        XmlDocument doc2 = new XmlDocument();
                        doc2.Load(item["path"].InnerText);
                        XmlNode node = doc2.DocumentElement;
                        foreach (XmlNode key in node.ChildNodes[1])
                        {
                            ProgramA p = new ProgramA();
                            p.Time = Convert.ToDateTime(key["playTime"].InnerText);
                            p.Meridien = key["meridien"].InnerText;
                            p.Name = key["programName"].InnerText;
                            p.Path = key["path"].InnerText;
    
                            proList.Add(p);
                        }
                        channel.List = proList;
                        list.Add(channel);
                    }
                    else
                    {
                        TypeB channel = new TypeB();
                        channel.Type = item["channelType"].InnerText;
                        channel.ChannelName = item["tvChannel"].InnerText;
                        channel.Path = item["path"].InnerText;
    
                        List<ProgramB> proList = new List<ProgramB>();
                        XmlDocument doc2 = new XmlDocument();
                        doc2.Load(item["path"].InnerText);
                        XmlNode node = doc2.DocumentElement;
                        foreach (XmlNode key in node.ChildNodes[0])
                        {
                            ProgramB p = new ProgramB();
                            p.Time = Convert.ToDateTime(key["playTime"].InnerText);
                            p.Name = key["name"].InnerText;
                            p.Path = key["path"].InnerText;
    
                            proList.Add(p);
                        }
                        channel.List = proList;
                        list.Add(channel);
                    }
                    
                }
            }
        }

    最后 核心的代码

    然后 完成

  • 相关阅读:
    下巴肉和脖子肉怎么减肥
    java中compareTo和compare方法之比较,集合中对象的比较
    easyui中combotree只能选子选项,父级不被选中
    java线程总结(2/5)
    流行的框架与新技术
    Spring官网改版后下载
    prepareStatement与Statement的区别
    jQuery li click失效问题
    Flask 启动报错 error: [Errno 10053]
    [linux]CentOS 7 下安装 RabbitMQ
  • 原文地址:https://www.cnblogs.com/swordtm/p/5846308.html
Copyright © 2011-2022 走看看