Пример #1
0
        private void fillList()
        {
            RoomsDetection roomsDetection = new RoomsDetection();

            if (_context.MovementSekv.Any())
            {
                var movSekvList = _context.MovementSekv.ToList();

                foreach (var movSekv in movSekvList)
                {
                    DateTime convertedDate = DateTime.Parse(movSekv.TimeStamp);

                    Izby   izba     = null;
                    String izbaName = "";
                    try {
                        izba     = _context.Rooms.Where(t => t.IzbaID == movSekv.IzbyFK).First();
                        izbaName = izba.Nazov;
                    }
                    catch (Exception e)
                    {
                        izbaName = "Vonku";
                    }
                    string alert = "NA";

                    if (movSekv.Upozornenie_Cas != 0)
                    {
                        alert = "Čas";
                    }
                    else if (movSekv.Upozornenie_Hranica != 0)
                    {
                        alert = "Hranica";
                    }


                    MovementObj movObj = new MovementObj
                    {
                        PohId    = movSekv.PohSekvId,
                        RoomName = izbaName,
                        Alert    = alert,
                        LongDate = convertedDate.ToLongDateString(),
                        Date     = convertedDate.ToShortDateString(),
                        Time     = convertedDate.ToLongTimeString(),
                        Duration = movSekv.Cas_Zotrvania,
                        xValue   = movSekv.Xhodnota,
                        yValue   = movSekv.Yhodnota
                    };

                    SequenceList.Add(movObj);
                }
                fillPageWithSequence(SequenceList.Last());
            }
            else
            {
                MovAlert = "Neexistuje žiadna sekvencia";
            }

            SequenceList = new ObservableCollection <MovementObj>(SequenceList.Reverse());
        }
Пример #2
0
        private void fillPageWithSequence(MovementObj mo)
        {
            MovAlert  = mo.Alert;
            RoomValue = mo.RoomName;
            MovTime   = mo.LongDate + " " + mo.Time;
            if (mo.Duration.Equals(""))
            {
                MovDuration = "0 min";
            }
            else
            {
                MovDuration = mo.Duration + " min";
            }

            MyEvent?.Invoke(mo.xValue, mo.yValue);
        }