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