示例#1
0
 private void btnIzbrisiPrograma_Click(object sender, EventArgs e)
 {
     if (lstEmisii.SelectedIndex != -1)
     {
         DialogResult odg = MessageBox.Show("Дали сте сигурни?", "Бришење на програма",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (odg != DialogResult.No)
         {
             TVProgram tvProgram = lstEmisii.SelectedItem as TVProgram;
             lstEmisii.Items.Remove(tvProgram);
         }
     }
 }
示例#2
0
        double prosecno()
        {
            /*
             * @return:
             *  Go vrakja prosecnoto vremetraenje vo minuti na site programi na odreden TV kanal
             */
            double prosek = 0;
            double suma   = 0;

            foreach (object obj in lstEmisii.Items)
            {
                TVProgram tvProg = obj as TVProgram;
                int       m      = tvProg.Casovi * 60 + tvProg.Minuti;
                suma += m;
            }
            prosek = suma / lstEmisii.Items.Count;
            txtVremetraenje.Text = prosek.ToString();
            return(prosek);
        }
示例#3
0
        private void btnDodadiPrograma_Click(object sender, EventArgs e)
        {
            string ime    = tbIme.Text;
            int    m      = Convert.ToInt32(numVremetraenje.Value);
            int    minuti = 0;
            int    casovi = 0;

            if (m < 60)
            {
                minuti = m;
                casovi = 0;
            }
            else
            {
                casovi = m / 60;
                minuti = m % 60;
            }
            TVProgram tvProg = new TVProgram(ime, casovi, minuti);

            lstEmisii.Items.Add(tvProg);
            prosecno();
        }