using ComeCapture.Models;

using System.Text;

namespace ComeCapture
{
    public class AppModel : EntityBase
    {
        public AppModel()
        {
            _current = this;
        }

        #region 属性 Current

        private static AppModel _current;

        public static AppModel Current => _current;

        #endregion 属性 Current

        #region 属性 MaskLeftWidth

        private double _maskLeftWidth = JieTuWindow.ScreenWidth;

        public double MaskLeftWidth
        {
            get => _maskLeftWidth;
            set
            {
                _maskLeftWidth = value;
                ShowSizeLeft = value;
                RaisePropertyChanged(() => MaskLeftWidth);
            }
        }

        #endregion 属性 MaskLeftWidth

        #region 属性 MaskRightWidth

        private double _maskRightWidth;

        public double MaskRightWidth
        {
            get => _maskRightWidth;
            set
            {
                _maskRightWidth = value;
                RaisePropertyChanged(() => MaskRightWidth);
            }
        }

        #endregion 属性 MaskRightWidth

        #region 属性 MaskTopWidth

        private double _maskTopWidth;

        public double MaskTopWidth
        {
            get => _maskTopWidth;
            set
            {
                _maskTopWidth = value;
                RaisePropertyChanged(() => MaskTopWidth);
            }
        }

        #endregion 属性 MaskTopWidth

        #region 属性 MaskTopHeight

        private double _maskTopHeight;

        public double MaskTopHeight
        {
            get => _maskTopHeight;
            set
            {
                _maskTopHeight = value;
                ShowSizeTop = MaskTopHeight < 40 ? MaskTopHeight : MaskTopHeight - 40;
                RaisePropertyChanged(() => MaskTopHeight);
            }
        }

        #endregion 属性 MaskTopHeight

        #region 属性 MaskBottomHeight

        private double _maskBottomHeight;

        public double MaskBottomHeight
        {
            get => _maskBottomHeight;
            set
            {
                _maskBottomHeight = value;
                RaisePropertyChanged(() => MaskBottomHeight);
            }
        }

        #endregion 属性 MaskBottomHeight

        #region 属性 ShowSize

        private string _showSize = "0 × 0";

        public string ShowSize
        {
            get => _showSize;
            set
            {
                _showSize = value;
                RaisePropertyChanged(() => ShowSize);
            }
        }

        private static StringBuilder _sb = new StringBuilder();

        public void ChangeShowSize()
        {
            _sb = new StringBuilder();
            _sb.Append((int)(JieTuWindow.Current.MainImage.Width * JieTuWindow.ScreenScale));
            _sb.Append(" × ");
            _sb.Append((int)(JieTuWindow.Current.MainImage.Height * JieTuWindow.ScreenScale));
            ShowSize = _sb.ToString();
        }

        #endregion 属性 ShowSize

        #region 属性 ShowSizeLeft

        private double _showSizeLeft;

        public double ShowSizeLeft
        {
            get => _showSizeLeft;
            set
            {
                _showSizeLeft = value;
                RaisePropertyChanged(() => ShowSizeLeft);
            }
        }

        #endregion 属性 ShowSizeLeft

        #region 属性 ShowSizeTop

        private double _showSizeTop;

        public double ShowSizeTop
        {
            get => _showSizeTop;
            set
            {
                _showSizeTop = value;
                RaisePropertyChanged(() => ShowSizeTop);
            }
        }

        #endregion 属性 ShowSizeTop

        #region 属性 ShowRGB

        private string _showRgb = string.Empty;

        public string ShowRGB
        {
            get => _showRgb;
            set
            {
                _showRgb = value;
                RaisePropertyChanged(() => ShowRGB);
            }
        }

        #endregion 属性 ShowRGB
    }
}