Esempio n. 1
0
        public int Compare(object o1, object o2)
        {
            Broadcast b1 = (Broadcast)o1;
            Broadcast b2 = (Broadcast)o2;

            if (b1.getStart() > b2.getStart())
            {
                return(1);
            }
            else if (b1.getStart() < b2.getStart())
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 2
0
 public Memo(Broadcast broadcast, DateTime timer)
 {
     this.broadcast        = broadcast;
     this.alreadyDone      = false;
     this.broadcastTitle   = broadcast.getTitle();
     this.broadcastChannel = broadcast.getChannel();
     this.broadcastStart   = broadcast.getStart();
     this.broadcastEnd     = broadcast.getEnd();
     this.timer            = timer;
 }
Esempio n. 3
0
        private void bSearch_Click(object sender, EventArgs e)
        {
            bool search = true;

            this.listViewBroadcasts.Dispose();
            this.listViewBroadcasts               = new CustomTVBrowserList(new System.Drawing.SizeF(this.Width, this.Height));
            this.listViewBroadcasts.ImageList     = null;
            this.listViewBroadcasts.Name          = "listViewBroadcasts";
            this.listViewBroadcasts.ShowScrollbar = true;
            this.initVideoMode();
            this.listViewBroadcasts.TabIndex = 0;
            this.listViewBroadcasts.TopIndex = 0;
            this.listViewBroadcasts.WrapText = false;
            this.listViewBroadcasts.Click   += new System.EventHandler(this.listViewBroadcasts_Click);
            String stmt = "SELECT b.id as id, b.tvbrowserID as tvbrowserid, c.name as channel, b.channel_id as channel_id, b.title as title, strftime('%Y-%m-%d-%H-%M', b.start) as start, strftime('%Y-%m-%d-%H-%M', b.end) as end, b.favorite as favorite, b.reminder as reminder FROM channel c, broadcast b, info i where c.id = b.channel_id AND i.broadcast_id=b.id";

            if (this.radioButtonFavorites.Checked)
            {
                stmt += " AND b.favorite='1'";
            }
            else if (this.radioButtonReminder.Checked)
            {
                stmt += " AND b.reminder='1'";
            }
            else
            {
                if (this.tbSearch.Text.Length > 0)
                {
                    if (this.checkBoxExact.Checked)
                    {
                        if (this.comboBoxElement.SelectedIndex == 0)
                        {
                            stmt += " AND b.title ='" + this.tbSearch.Text.Replace("'", "''") + "'";
                        }
                        else
                        {
                            SearchElement se = (SearchElement)this.comboBoxElement.SelectedItem;
                            stmt += " AND i." + se.getDatabasename() + " ='" + this.encode(this.tbSearch.Text) + "'";
                        }
                    }
                    else
                    {
                        if (this.comboBoxElement.SelectedIndex == 0)
                        {
                            stmt += " AND b.title LIKE '%" + this.tbSearch.Text.Replace("'", "''") + "%'";
                        }
                        else
                        {
                            SearchElement se = (SearchElement)this.comboBoxElement.SelectedItem;
                            stmt += " AND i." + se.getDatabasename() + " LIKE '%" + this.encode(this.tbSearch.Text) + "%'";
                        }
                    }
                }
                else
                {
                    MessageBox.Show(this.con.getLanguageElement("Search.SearchString", "search item is too short (at least one character)"));
                    search = false;
                }
            }

            String date = "";

            if (this.comboBoxDates.SelectedIndex > 1)
            {
                date  = ((TVBrowserDate)this.comboBoxDates.SelectedItem).getDateTime().Year.ToString();
                date += "-";
                if (((TVBrowserDate)this.comboBoxDates.SelectedItem).getDateTime().Month < 10)
                {
                    date += "0";
                }
                date += ((TVBrowserDate)this.comboBoxDates.SelectedItem).getDateTime().Month.ToString();
                date += "-";
                if (((TVBrowserDate)this.comboBoxDates.SelectedItem).getDateTime().Day < 10)
                {
                    date += "0";
                }
                date           += ((TVBrowserDate)this.comboBoxDates.SelectedItem).getDateTime().Day.ToString();
                this.broadcasts = new ArrayList();
                stmt           += " AND date(b.start)=date('" + date + "')";
            }
            else if (this.comboBoxDates.SelectedIndex == 1)
            {
                date            = DateTime.Now.ToString("yyyy-MM-dd");
                this.broadcasts = new ArrayList();
                stmt           += " AND date(b.start) >= date('" + date + "')";
            }
            if (this.comboBoxChannel.SelectedIndex > 0)
            {
                stmt += " AND c.name ='" + this.comboBoxChannel.SelectedItem.ToString() + "'";
            }
            if (search)
            {
                Cursor.Current = Cursors.WaitCursor;
                broadcasts     = this.con.getBroadcastsBySearch(stmt);
                Cursor.Current = Cursors.Default;
                for (int i = 0; i < broadcasts.Count; i++)
                {
                    Broadcast temp = (Broadcast)broadcasts[i];
                    this.listViewBroadcasts.Items.Add(this.con.createColoredListItem(temp, this.getReducedString(temp.getStart().ToShortDateString() + "|" + temp.getChannel() + "|" + temp.ToString(), this.Width)));
                }
                this.Controls.Add(this.listViewBroadcasts);

                if (this.broadcasts.Count < 1)
                {
                    MessageBox.Show(this.con.getLanguageElement("Search.WarningNothingFound", "Sorry - nothing found"));
                }
            }

            if (this.listViewBroadcasts.Items.Count > 0)
            {
                this.listViewBroadcasts.SelectedIndex = 0;
                this.listViewBroadcasts.Focus();
            }
        }