public void SetDatabaseScreenInfo(Videopanel screenInfo)
        {
            var widthParameter  = (_unitOfWork.Parameters.Find(ParameterSpecification.OfType <ScreenWidth>())).FirstOrDefault();
            var heightParameter = (_unitOfWork.Parameters.Find(ParameterSpecification.OfType <ScreenHeight>())).FirstOrDefault();

            if (widthParameter == null)
            {
                _unitOfWork.Parameters.Create(new ScreenWidth
                {
                    Value = screenInfo.Width.ToString()
                });
            }
            else
            {
                widthParameter.Value = screenInfo.Width.ToString();
                _unitOfWork.Parameters.Update(widthParameter);
            }
            if (heightParameter == null)
            {
                _unitOfWork.Parameters.Create(new ScreenHeight
                {
                    Value = screenInfo.Height.ToString()
                });
            }
            else
            {
                heightParameter.Value = screenInfo.Height.ToString();
                _unitOfWork.Parameters.Update(heightParameter);
            }

            _unitOfWork.Displays.DeleteRange(_unitOfWork.Displays.GetAll());
            _unitOfWork.Displays.CreateMany(screenInfo.Displays);
            _unitOfWork.Complete();
        }
        public Videopanel GetDatabaseScreenInfo()
        {
            var widthParameter  = (_unitOfWork.Parameters.Find(ParameterSpecification.OfType <ScreenWidth>())).FirstOrDefault();
            var heightParameter = (_unitOfWork.Parameters.Find(ParameterSpecification.OfType <ScreenHeight>())).FirstOrDefault();

            if (widthParameter != null && heightParameter != null && _unitOfWork.Displays.Count(d => true) > 0)
            {
                return new Videopanel
                       {
                           Height   = Convert.ToInt32(heightParameter.Value),
                           Width    = Convert.ToInt32(widthParameter.Value),
                           Displays = _unitOfWork.Displays.GetAll().ToArray()
                       }
            }
            ;
            return(null);
        }
Exemple #3
0
        public void SetBackground(string color)
        {
            var backgroundColor = (_unitOfWork.Parameters.Find(ParameterSpecification.OfType <BackgroundColor>())).FirstOrDefault();

            if (backgroundColor == null)
            {
                _unitOfWork.Parameters.Create(new BackgroundColor
                {
                    Value = color
                });
            }
            else
            {
                backgroundColor.Value = color;
                _unitOfWork.Parameters.Update(backgroundColor);
            }
            _unitOfWork.Complete();
        }
Exemple #4
0
        public string GetBackground()
        {
            var backgroundColor = (_unitOfWork.Parameters.Find(ParameterSpecification.OfType <BackgroundColor>())).FirstOrDefault();

            return(backgroundColor?.Value ?? string.Empty);
        }