1 |
using System; |
2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel; |
4 |
using System.Drawing; |
5 |
using System.Data; |
6 |
using System.Linq; |
7 |
using System.Text; |
8 |
using System.Windows.Forms; |
9 |
using libxmltv.Interfaces; |
10 |
|
11 |
namespace xmltv_parser |
12 |
{ |
13 |
public partial class ProgramEntryControl : UserControl |
14 |
{ |
15 |
IProgramDefinition program; |
16 |
public ProgramEntryControl() : this(null) { } |
17 |
public ProgramEntryControl(IProgramDefinition program) |
18 |
{ |
19 |
InitializeComponent(); |
20 |
this.program = program; |
21 |
LoadProgramInformation(); |
22 |
} |
23 |
|
24 |
private void LoadProgramInformation() |
25 |
{ |
26 |
if (this.program == null) { return; } |
27 |
//txtProgramTitle.Text = this.program.Title; |
28 |
////txtProgramSubTitle.Text = this.program.SubTitle; |
29 |
//txtProgramDescription.Text = this.program.Description; |
30 |
|
31 |
DateTime start = DateTime.Parse(this.program.Start); |
32 |
DateTime stop = DateTime.Parse(this.program.Stop); |
33 |
TimeSpan length = (stop - start); |
34 |
//string channel = string.Format("{0}:{1}", this.program.ChannelNumber, this.program.ChannelName); |
35 |
string runtime = string.Format("{0}min", length.TotalMinutes); |
36 |
//txtProgramAirTime.Text = string.Format("{0}{1}{2}", start.ToString("hh:mm tt (dddd dd/yyyy)"), channel, runtime); |
37 |
|
38 |
txtProgramTitle.Text = string.Format("{0}: {1} {2}", this.program.Title, this.program.SubTitle, this.program.Rating == string.Empty ? string.Empty : string.Format("({0})", this.program.Rating)); |
39 |
txtProgramDescription.Text = string.Format(" {0}", this.program.Description); |
40 |
txtProgramAirTime.Text = string.Format(" Airs: {0} at {1} on channel: {2} ({3}) ({4})", start.ToString("dddd (MMMM dd, yyyy)"), start.ToString("hh:mm tt"), this.program.ChannelNumber, this.program.ChannelName, runtime); |
41 |
} |
42 |
|
43 |
private void ProgramEntryControl_Load(object sender, EventArgs e) |
44 |
{ |
45 |
this.Focus(); |
46 |
} |
47 |
} |
48 |
} |