private void open_epg(string id) { //formating datetime string y = (DateTime.Now.Year - 2000).ToString(); string d = DateTime.Now.Day.ToString(); if (d.Length == 1) { d = "0" + d; } string m = DateTime.Now.Month.ToString(); if (m.Length == 1) { m = "0" + m; } string dt = d + m + y; //get epg epg_list.Items.Clear(); try { lp = api.epg(active_ch, dt); foreach (Programs p in lp) { ProgramEPG item = new ProgramEPG(); item.epg_program = p.progname; item.epg_time = p.t_start; epg_list.Items.Add(item);//epg_list.ItemContainerStyle. } epg(id); isepg = true; } catch (Exception ex) { isepg = false; System.Windows.Forms.MessageBox.Show("Ошыбка одержание программы\n" + ex.Message, "Ошыбка", MessageBoxButtons.OK, MessageBoxIcon.Error); error_log(ex); } }
private void epg(string id) { try { le = api.epg_next(id); bool p = false; for (int i = 0; i < epg_list.Items.Count - 2; i++) { ProgramEPG item = (ProgramEPG)epg_list.Items[i]; ProgramEPG item1 = (ProgramEPG)epg_list.Items[i + 1]; ProgramEPG item2 = (ProgramEPG)epg_list.Items[i + 2]; if (item.epg_program == le[0].progname) { if (item1.epg_program == le[1].progname) { if (item2.epg_program == le[2].progname) { //epg_list.Items[i].BackColor = Color.White; System.Windows.Controls.ListViewItem l = (System.Windows.Controls.ListViewItem)epg_list.Items[i]; l.Background = Brushes.White; p = true; } else if (!p) { //epg_list.Items[i].BackColor = Color.Gray; System.Windows.Controls.ListViewItem l = (System.Windows.Controls.ListViewItem)epg_list.Items[i]; l.Background = Brushes.Gray; } else { //epg_list.Items[i].BackColor = Color.White; System.Windows.Controls.ListViewItem l = (System.Windows.Controls.ListViewItem)epg_list.Items[i]; l.Background = Brushes.White; } } else if (!p) { //epg_list.Items[i].BackColor = Color.Gray; System.Windows.Controls.ListViewItem l = (System.Windows.Controls.ListViewItem)epg_list.Items[i]; l.Background = Brushes.Gray; } else { //epg_list.Items[i].BackColor = Color.White; System.Windows.Controls.ListViewItem l = (System.Windows.Controls.ListViewItem)epg_list.Items[i]; l.Background = Brushes.White; } } else if (!p) { //epg_list.Items[i].BackColor = Color.Gray; System.Windows.Controls.ListViewItem l = (System.Windows.Controls.ListViewItem)epg_list.Items[i]; l.Background = Brushes.Gray; } else { //epg_list.Items[i].BackColor = Color.White; System.Windows.Controls.ListViewItem l = (System.Windows.Controls.ListViewItem)epg_list.Items[i]; l.Background = Brushes.White; } } } catch (Exception) { } }
private void open_epg(string id) { //formating datetime string y = (DateTime.Now.Year - 2000).ToString(); string d = DateTime.Now.Day.ToString(); if (d.Length == 1) d = "0" + d; string m = DateTime.Now.Month.ToString(); if (m.Length == 1) m = "0" + m; string dt = d + m + y; //get epg epg_list.Items.Clear(); try { lp = api.epg(active_ch, dt); foreach (Programs p in lp) { ProgramEPG item = new ProgramEPG(); item.epg_program = p.progname; item.epg_time = p.t_start; epg_list.Items.Add(item);//epg_list.ItemContainerStyle. } epg(id); isepg = true; } catch (Exception ex) { isepg = false; System.Windows.Forms.MessageBox.Show("Ошыбка одержание программы\n" + ex.Message, "Ошыбка", MessageBoxButtons.OK, MessageBoxIcon.Error); error_log(ex); } }