/[xmltv_parser]/trunk/xmltv_parser/main.cs
ViewVC logotype

Diff of /trunk/xmltv_parser/main.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16 by william, Thu Mar 7 09:26:43 2013 UTC revision 30 by william, Thu Mar 7 13:36:42 2013 UTC
# Line 2  Line 2 
2  using System.Collections.Generic;  using System.Collections.Generic;
3  using System.ComponentModel;  using System.ComponentModel;
4  using System.Data;  using System.Data;
5    using System.Linq;
6  using System.Drawing;  using System.Drawing;
7  using System.Text;  using System.Text;
8  using System.Windows.Forms;  using System.Windows.Forms;
9  using libxmltv.Core;  using libxmltv.Core;
10  using Enterprise.Logging;  using Enterprise.Logging;
11    using libxmltv.Interfaces;
12    
13  namespace xmltv_parser  namespace xmltv_parser
14  {  {
# Line 17  namespace xmltv_parser Line 19  namespace xmltv_parser
19              InitializeComponent();              InitializeComponent();
20              string log_path = Application.StartupPath;              string log_path = Application.StartupPath;
21              string log_filename = string.Format("{0}.log", typeof(main).Assembly.GetName().Name);              string log_filename = string.Format("{0}.log", typeof(main).Assembly.GetName().Name);
22              gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All);                          gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All);
23          }          }
24    
25            //List<IXMLTVChannel> Channels;
26            List<IXMLTVProgram> Programs;
27    
28          private void main_Load(object sender, EventArgs e)          private void main_Load(object sender, EventArgs e)
29          {          {
30    
31          }          }
32          private void main_Shown(object sender, EventArgs e)          private void main_Shown(object sender, EventArgs e)
33          {          {
34              gLog.Log.Debug.WriteLine("");          }
35              var xmltv = XMLTV.CreateLoader("20130307_continuum_schedule.xml");  
36              //XMLTV.Test(xmltv);  
37            void LoadXMLTVShcedule(string schedule_xml)
38            {
39                var xmltv_loader = XMLTV.CreateLoader(schedule_xml);
40                var xmltv_parser = XMLTV.CreateParser(xmltv_loader);
41                var p = XMLTV.GetParser(xmltv_parser);
42    
43                //var channel_count = p.Channels.Values.Count;
44                //Channels = p.Channels.Values.ToList().GetRange(0, channel_count).ToList();
45                var program_count = p.Programs.Values.Count;
46                var program_list = p.Programs.Values.ToList().OrderBy(s => s.Start);
47                //Programs = program_list(0, program_count).ToList();
48                Programs = new List<IXMLTVProgram>(program_list.ToArray());
49            }
50    
51            void CreateControls()
52            {
53                foreach (var program in Programs)
54                {
55                    ListViewItem li = new ListViewItem(string.Format("{0} {1}", program.Channel.Number, program.Channel.CallSign));
56                    li.SubItems.Add(new ListViewItem.ListViewSubItem(li, program.Title));
57                    li.SubItems.Add(new ListViewItem.ListViewSubItem(li, program.SubTitle));
58                    li.SubItems.Add(new ListViewItem.ListViewSubItem(li, program.Description));
59                    li.SubItems.Add(new ListViewItem.ListViewSubItem(li, program.Start.ToString("yyyy/MM/dd hh:mm tt")));
60                    li.SubItems.Add(new ListViewItem.ListViewSubItem(li, program.Stop.ToString("yyyy/MM/dd hh:mm tt")));
61                    lstPrograms.Items.Add(li);
62                }
63            }
64    
65            private void mnuItemOpenXMLTVFile_Click(object sender, EventArgs e)
66            {
67                LoadXMLTVShcedule("20130307_continuum_schedule.xml");
68                //var result = xmltv_file_chooser.ShowDialog();
69                //if (result != DialogResult.OK) return;
70                //LoadXMLTVShcedule(xmltv_file_chooser.FileName);
71                CreateControls();
72            }
73    
74            private void mnuItemOpenSavedData_Click(object sender, EventArgs e)
75            {
76    
77            }
78    
79            private void mnuItemSaveData_Click(object sender, EventArgs e)
80            {
81    
82          }          }
83      }      }
84  }  }
85    

Legend:
Removed from v.16  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.22