예제 #1
0
        private async Task DisplayScreenModelAsync(IDisplayLane lane)
        {
            while (true)
            {
                foreach (var person in lane.People.ToList())
                {
                    if (lane.GetType() == typeof(KioskDisplayLane))
                    {
                        if ((DateTime.Now >= person.NextDisplayTime))
                        {
                            Debug.WriteLine($"Displaying {person} for {person.CurrentDisplayCount} in lane {lane.LaneIndex}");
                            await Animate(person, lane);

                            person.CurrentDisplayCount += 1;
                            //TODO: Refactor out RecycleCount
                            if (person.CurrentDisplayCount >= Configuration.KioskDisplayRecycleCount)
                            {
                                lane.People.Remove(person);
                            }
                        }
                        continue;
                    }
                    await Animate(person, lane);

                    var percent = lane.People.IndexOf(person).ToDouble().PercentOf(DefaultTakeCount.ToDouble());
                    if (percent >= 90)
                    {
                        AsyncHelper.FireAndForget(
                            () => lane.UpdateQueueAsync(_currentCount, DefaultTakeCount, WebServerUrl),
                            e =>
                        {
                            Console.WriteLine(@"Error updating name queue for general names");
                            Debug.WriteLine(e);
                        });
                        _currentCount += DefaultTakeCount;
                    }
                    using (Canceller.Token.Register(Thread.CurrentThread.Abort))
                    {
                        //NOTE: This is amount of time before next name displays and begins animation
                        await Task.Delay(TimeSpan.FromSeconds(lane.RotationDelay), Canceller.Token);
                    }
                }

                //TODO: If queue list is not populated continue with existing list. Notifiy issue
                if (!lane.Queue.Any())
                {
                    continue;
                }

                //NOTE: If current queue count less than DefaultTakeCount assume at end of database list and start over at beginning. Need to same position for next runtime.
                if (lane.Queue.Count < DefaultTakeCount)
                {
                    _currentCount = 0;
                }

                lane.People.Clear();
                lane.People.AddRange(lane.Queue);
                lane.Queue.Clear();
            }
        }
예제 #2
0
        private Border CreateBorder(Label label, IDisplayLane lane)
        {
            var borderName = "border" + Guid.NewGuid().ToString("N").Substring(0, 10);
            var width      = lane.GetType() == typeof(KioskDisplayLane) && Person.IsFirstRun ? lane.LaneWidth : label.ActualWidth;
            var border     = new Border()
            {
                Name  = borderName,
                Uid   = borderName,
                Child = label,
                Width = width,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            if (!_debugMode)
            {
                return(border);
            }

            border.BorderBrush     = Brushes.Red;
            border.BorderThickness = new Thickness(2);

            return(border);
        }