using HandyControl.Controls;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows.Controls;
using TouchSocket.Core;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.Model.ApiModel.StoreInfo;
using 智慧物流软件系统.Tool;

namespace 智慧物流软件系统.ViewModel
{
    public class MatDetailCurrentInfoUpdateViewModel : BindableBase
    {
        public MatDetailCurrentInfoModel model { get; set; }

        public System.Windows.Controls.TextBox textBox { get; set; }

        #region Property 属性
        public void SetValues(MatDetailCurrentInfoModel matDetailCurrentInfoModel)
        {
            model = matDetailCurrentInfoModel;

            ShelfType = matDetailCurrentInfoModel.ShelfType;
            ShelfCode = matDetailCurrentInfoModel.ShelfCode;

            LocationArea = matDetailCurrentInfoModel.LocationArea;
            LocationCode = matDetailCurrentInfoModel.LocationCode;

            MatName = matDetailCurrentInfoModel.MatName;
            MatCode = matDetailCurrentInfoModel.MatCode;
            MatSpec = matDetailCurrentInfoModel.MatSpec;
            MatQty = matDetailCurrentInfoModel.MatQty;

            if (textBox != null)
                Task.Run(() =>
                {
                    Thread.Sleep(100);
                    App.Current.Dispatcher.Invoke(() =>
                    {
                        textBox.Focus();
                    });
                });
           
        }

        public MatDetailCurrentInfoModel GetValues()
        {
            if (model == null)
            {
                return null;
            }
            model.MatQty = MatQty;
            return model;
        }

        private string shelfCode;
        public string ShelfCode
        {
            get { return shelfCode; }
            set
            {
                SetProperty(ref shelfCode, value);
            }
        }

        private string shelfType;
        public string ShelfType
        {
            get { return shelfType; }
            set
            {
                SetProperty(ref shelfType, value);
            }
        }

        private string locationArea;

        public string LocationArea
        {
            get { return locationArea; }
            set
            {
                SetProperty(ref locationArea, value);
            }
        }

        private string locationCode;

        public string LocationCode
        {
            get { return locationCode; }
            set
            {
                SetProperty(ref locationCode, value);
            }
        }

        private string matCode;
        public string MatCode
        {
            get { return matCode; }
            set
            {
                SetProperty(ref matCode, value);
            }
        }


        private string matName;
        public string MatName
        {
            get { return matName; }
            set
            {
                SetProperty(ref matName, value);
            }
        }

        private string matSpec;
        public string MatSpec
        {
            get { return matSpec; }
            set
            {
                SetProperty(ref matSpec, value);
            }
        }

        private int matQty;
        public int MatQty
        {
            get { return matQty; }
            set
            {
                SetProperty(ref matQty, value);
            }
            #endregion
        }
    }
}