using MainShell.Hardware;
using MaxwellFramework.Core.Common;
using MaxwellFramework.Core.Interfaces;
using MwFramework.Controls.SystemCalib;
using MwFramework.ManagerService;
using Stylet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace MainShell.AlgorithmCalib.ViewModel
{
    public class PixRatioCalibViewModel:Screen,IPage
    {

        public string Name { get; set; } = "CameraPixRatioCalib";
        public string CalibName { get; set; }

        private CameraParaCalibViewModel _service;
        public CameraParaCalibViewModel Service
        {
            get { return _service; }
            set
            {
                _service = value;
                NotifyOfPropertyChange();
            }
        }

        /// <summary>
        /// 标定名称标识（用于UI显示和逻辑判断）
        /// </summary>


        /// <summary>
        /// 无参构造函数
        /// </summary>
        public PixRatioCalibViewModel()
        {

        }

        /// <summary>
        /// 手动创建时使用的静态工厂方法
        /// </summary>
        /// <param name="calibName">标定名称，如 "上相机像素比标定"</param>
        /// <param name="device">对应的硬件设备</param>
        public static PixRatioCalibViewModel Create(string calibName, List<HardwareDevice> device)
        {
            var vm = new PixRatioCalibViewModel();
            vm.Initialize(calibName, device);
            return vm;
        }

        private void Initialize(string calibName, List<HardwareDevice> device)
        {
            CalibName = calibName;
            var paramList = IoC.Get<IParameterManager>() as IParamList;

            Service = new CameraParaCalibViewModel(
                device,
                paramList,
                true
            );
            Service.IsShowSolidLine = true;
            Service.ShapeThickness = 1;
            Service.DrawInConcurrency = false;
            Service.IsAxisControlLDBVisible = Visibility.Visible;
        }
    }
}
