private void timer_Tick(object sender, EventArgs e)
        {
            TimeClass timeobject = new TimeClass();

            hourlabelstrip.Text = timeobject.clockshape();
            datelabelstrip.Text = timeobject.dateshape();


            AgendaClass ev = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            string hora       = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
            string fechal     = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();;
            string fechashort = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString();



            string orden = "SELECT DESCRIPCION, HORA, PRIORIDAD FROM " + UserAccessForm.getusername() + "_events_table WHERE (HORA='" + hora + "' AND ( FECHA='" + fechal + "' or `FECHA DE RECORDATORIO`='" + fechashort + "'))AND ACTIVO='SI';";

            if (ev.getnametarea(orden))
            {
                DireccionGestor.setsombrestatic(ev.getname());
                DireccionGestor.setotrostatic(ev.gettime());
                DireccionGestor.setprioridadstatic(ev.getprioridad());
                DireccionGestor.setestadostatic(true);

                SystemSounds.Hand.Play();
                MessageBox.Show("SON LAS " + ev.gettime() + " ES HORA DE " + ev.getname());
            }
            cuenta++;
            if (cuenta == 5000)
            {
                cuenta = 0;
                backbuttonstrip.PerformClick();
            }
        }
示例#2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            //cont.Text = cuenta.ToString();
            cuenta++;
            cuentasonido++;

            TimeClass timeobject = new TimeClass();

            clocklabel.Text = timeobject.clockshape();
            datelabel.Text  = timeobject.dateshape();

            string day = DateTime.Now.DayOfWeek.ToString();

            switch (day)
            {
            case "Monday":
                daylabel.Text = "LUNES";
                break;

            case "Tuesday":
                daylabel.Text = "MARTES";
                break;

            case "Wednesday":
                daylabel.Text = "MIERCOLES";
                break;

            case "Thursday":
                daylabel.Text = "JUEVES";
                break;

            case "Friday":
                daylabel.Text = "VIERNES";
                break;

            case "Saturday":
                daylabel.Text = "SABADO";
                break;

            case "Sunday":
                daylabel.Text = "DOMINGO";
                break;
            }


            AgendaClass ev    = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
            DateTime    fecha = DateTime.Now;

            ev.ShowDataGridinicio(datainicio, UserAccessForm.getusername(), fecha, daylabel.Text);
            cuentalabel.Text = ev.getcuenta().ToString();

            if (cuenta == 600)
            {
                cuenta = 0;
                panel1.Hide();
                eventonamelabel.Text = "";
                eventohoralabel.Text = "";
                estadostatic         = false;
            }

            string hora       = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
            string fechal     = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();;
            string fechashort = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString();



            WindowsMediaPlayer wplayer = new WindowsMediaPlayer();
            string             orden   = "SELECT DESCRIPCION, HORA, PRIORIDAD, SONIDO FROM " + UserAccessForm.getusername() + "_events_table WHERE (HORA='" + hora + "' AND ( FECHA='" + fechal + "' or `FECHA DE RECORDATORIO`='" + fechashort + "'))AND ACTIVO='SI';";

            if (ev.getnametarea(eventonamelabel, eventohoralabel, prioridadbox, melodybox, orden))
            {
                SystemSounds.Hand.Play();

                panel1.Show();

                cuenta       = 0;
                cuentasonido = 0;



                setsombrestatic(eventonamelabel.Text);
                setotrostatic(eventohoralabel.Text);
                setprioridadstatic(prioridadbox.Text);
                setestadostatic(true);

                if (prioridadbox.Text == "0")
                {
                    panel1.BackColor = Color.Red;
                }
                else if (prioridadbox.Text == "1")
                {
                    panel1.BackColor = Color.Orange;
                }
                else if (prioridadbox.Text == "2")
                {
                    panel1.BackColor = Color.Yellow;
                }

                if (melodybox.Text != "")
                {
                    estatesong = false;
                    string path        = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
                    string combinacion = System.IO.Path.Combine(path, UserAccessForm.getusername());

                    string melodypath = System.IO.Path.Combine(combinacion, melodybox.Text);

                    wplayer.URL = melodypath;
                    wplayer.controls.play();
                }
                else
                {
                    estatesong = true;
                }

                if (MessageBox.Show("SON LAS " + eventohoralabel.Text + " ES HORA DE " + eventonamelabel.Text, "PARAR", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    cuentasonido = 0;

                    estatesong = false;
                }
                else
                {
                    cuentasonido = 0;
                    estatesong   = true;
                }
            }

            if (cuentasonido == 300 && melodybox.Text != "" && estatesong == true)
            {
                if (MessageBox.Show("SON LAS " + eventohoralabel.Text + " ES HORA DE " + eventonamelabel.Text, "PARAR", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    cuentasonido = 0;
                    estatesong   = false;
                }
                else
                {
                    cuentasonido = 0;
                    estatesong   = true;
                }
            }

            if (estatesong == false)
            {
                wplayer.controls.stop();
            }
        }