using ComeCapture.Models;

using System.Text;

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

        #region 属性 Current

        private static AppModel _Current = null;

        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 = 0;

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

        #endregion 属性 MaskRightWidth

        #region 属性 MaskTopWidth

        private double _MaskTopWidth = 0;

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

        #endregion 属性 MaskTopWidth

        #region 属性 MaskTopHeight

        private double _MaskTopHeight = 0;

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

        #endregion 属性 MaskTopHeight

        #region 属性 MaskBottomHeight

        private double _MaskBottomHeight = 0;

        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 = 0;

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

        #endregion 属性 ShowSizeLeft

        #region 属性 ShowSizeTop

        private double _ShowSizeTop = 0;

        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
    }
}