Singleton mode application ___ network TV genie ,__ network TV genie

Source: Internet
Author: User

Singleton mode application ___ network TV genie ,__ network TV genie

Network TV genie

 

 

First, create several basic classes.

 

 

 

Programming attributes: broadcast time, time period, name, and video path

Channel base class attributes: channel name, channel program list location, program list abstract method: Fetch ()

Compile the channel subclass to inherit the "channel base class" and implement Fetch () [write method declaration only]

Compile the channel factory class method: to create a channel subclass

 

 

 

 

 

 

 

Private void tsmAddToFavor_Click (object sender, EventArgs e)
{
// How to load a station from all the stations to my station
TreeNode tn = tvChannel. SelectedNode;
If (tn = null)
{
Return;
}
// 02. Determine if my radio station already exists.
Foreach (TreeNode child in tvChannel. Nodes [0]. Nodes)
{
If (child. Text = tn. Text)
{
Return;
}
}
// 03. Add the node to my radio station
// Obtain the Tag attribute of the selected node and convert it to ChannelBase
ChannelBase channel = (ChannelBase) tn. Tag;
// 04. Add the channel object to my radio station to become a node of my radio station
TreeNode node = new TreeNode ();
Node. Text = channel. channelName;
Node. Tag = channel;
TvChannel. Nodes [0]. Nodes. Add (node );
// 04. Add the channel to the Collection
MyManage. MyChannelList. Channellist. Add (channel );

}

Private void TMenuItemDel_Click (object sender, EventArgs e)
{
TreeNode node = tvChannel. SelectedNode;
Node. Remove ();

}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.