• 灭顶之灾之网络电视精灵——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);
                    }
                    
                }
            }
        }

    最后 核心的代码

    然后 完成

  • 相关阅读:
    MySQL新建用户,授权,删除用户,修改密码
    apache 压力测试
    wordpress设置导航栏
    关于PYTHON_EGG_CACHE无权限的问题
    ora 32021 设置参数时参数值长度超过255处理办法
    关于四字节字符入库时错误的解决方案(Incorrect string value: 'xF0x9Fx99x8F' for column 'Reply_Content' at row 1)
    Oracle Text Slowly
    Oracle Split Partitions
    下载有时失败
    Sytem 表空间很大
  • 原文地址:https://www.cnblogs.com/swordtm/p/5846308.html
Copyright © 2020-2023  润新知