using MaxwellFramework.Core.Interfaces;
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 DistortionCorrectionCalibViewModel:Screen,IPage
    {
        public string Name { get; set; } = "DistortionCorrectionCalib";

        /// <summary>
        /// 标定名称标识（用于UI显示和逻辑判断）
        /// </summary>
        public string CalibName { get; set; }

        private MwFramework.Controls.SystemCalib.DistortionCorrectionCalibViewModel _service;
        public MwFramework.Controls.SystemCalib.DistortionCorrectionCalibViewModel Service
        {
            get { return _service; }
            set
            {
                _service = value;
                NotifyOfPropertyChange();
            }
        }

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

        }

        /// <summary>
        /// 手动创建时使用的静态工厂方法
        /// </summary>
        /// <param name="calibName">相机名称，如 "BottomCamera"</param>
        /// <param name="device">对应的硬件设备</param>
        public static DistortionCorrectionCalibViewModel Create(string calibName, List<HardwareDevice> device)
        {
            var vm = new DistortionCorrectionCalibViewModel();
            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 MwFramework.Controls.SystemCalib.DistortionCorrectionCalibViewModel(
                device,
                paramList,
                true
            );
            Service.IsShowSolidLine = true;
            Service.ShapeThickness = 1;
            Service.DrawInConcurrency = false;
            Service.IsAxisControlLDBVisible = Visibility.Visible;
        }

    }
}
