Пример #1
0
        private void RegisterEvent(DateTime sendTime, String Message, String Code, SensorGroupCtrl g, String Type, bool registerOnly)
        {
            EventsController c;

            lock (dbcontext)
            {
                try
                {
                    c = new EventsController(dbcontext);
                    c.RegisterNewEvent(new Event {
                        Send_Date = sendTime, Reciv_Date = DateTime.Now, Messaje = Message, Code = Code, DeviceType = Type, SensorsInfo = d.Element("Devices").Elements("DeviceGroup").Single(x => x.Attribute("code").Value == g.Code).ToString(SaveOptions.DisableFormatting), SensorsGroup = new SensorsGroup {
                            Name = g.CodeName, Address = g.Code, DescriptiveName = g.DesciptiveName
                        }
                    }, EventType.EventType_Detection);
                }
                catch (Exception e) {
                    string s = e.Message;
                }
            }
            if (registerOnly)
            {
                return;
            }
            Action update = () =>
            {
                TAB_alarmGroup.SelectedTab = TAB_alarmGroup.TabPages[g.Code];
                TA_logArea.AppendText(g.DesciptiveName + ": " + DateTime.Now.ToShortTimeString() + " -->" + Message + ".Hora de Envío: " + sendTime.ToLongTimeString() + "\n");
            };

            this.Invoke(update);
            messages.Add(Message + ". Instancia, " + g.DesciptiveName);
            if (speechAble)
            {
                try
                {
                    speaker.SpeakAsyncCancelAll();
                    speaker.SpeakAsync(Message + ". Instancia, " + g.DesciptiveName);
                }
                catch (Exception) {
                    speechAble = false;
                }
            }

            if (!eventDetected)
            {
                eventDetected = true;
                if (doCall)
                {
                    CAllProcedure();
                    calltimer.Enabled = true;
                    calltimer.Start();
                }
            }
            timer.Start();
        }
Пример #2
0
        //Boton Filtrar(se filtra por el texto contenido en el textbox de filtro)
        private void button2_Click(object sender, EventArgs e)
        {
            String Text = TA_logArea.Text;

            TA_logArea.Text = "";
            String [] splitter = { "\n" };
            String[]  result   = Text.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
            foreach (String s in result)
            {
                if (s.Contains(TB_Filter.Text))
                {
                    TA_logArea.AppendText(s + "\n");
                }
            }
        }
Пример #3
0
        //Se Ejecuta la rutina de Busqueda en el Historial
        private void button1_Click(object sender, EventArgs e)
        {
            this.GB_filterPanel.Show();

            var fd = new FilterDialog();

            fd.ShowDialog();
            if (fd.Accepted)
            {
                TA_logArea.Text = "";
                var ec   = new EventsController(dbcontext);
                var evts = ec.ObtenerEventos(fd.FechInicio, fd.FechFin);
                evts.ForEach(s => TA_logArea.AppendText(s.Reciv_Date + "-->" + s.Messaje + "(" + s.SensorsGroup.Name + ")" + ".Hora de Envío:" + s.Send_Date + "\n"));
            }
        }