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);
                    }
                    
                }
            }
        }

    最后 核心的代码

    然后 完成

  • 相关阅读:
    桥接模式新解:客户端服务器模式
    laravel-admin 自定义导出表单
    PHP实现git部署的方法,可以学学!
    PHP的安全性问题,你能说得上几个?
    nginx的四个基本功能
    laravel orm
    laravel-admin列表排序在使用了$grid->model()->latest()后$grid其它加上sortable()可排序的列在排序时不起作用
    Laravel 5.4: 特殊字段太长报错 420000 字段太长
    关于在phpStudy环境下,windows cmd中 php不是内部命令问题
    phpstudy安装好之后mysql无法启动(亲测可行)
  • 原文地址:https://www.cnblogs.com/swordtm/p/5846308.html
Copyright © 2011-2022 走看看