FrmBasePoint.cs 1.2 KB
using System;
using System.Windows.Forms;

namespace ConveyorLine.EditPointCode
{
    public partial class FrmBasePoint : Form
    {
        public FrmBasePoint()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var code = numPointCode.Value;
            var x = (int)numX.Value;
            var y = (int)numY.Value;
            var find = EditPointCodeHelper.pointCodes.Find(s => s.Id == code);
            if (find != null)
            {
                find.X = x;
                find.Y = y;
                EditPointCodeHelper.BasePointCode = find;
                Close();
            }
            else
            {
                MessageBox.Show($"无法设置该地标为基准点【{code}】,因不存在");
            }
        }

        private void numPointCode_ValueChanged(object sender, EventArgs e)
        {
            var code = numPointCode.Value;
            var find = EditPointCodeHelper.pointCodes.Find(s => s.Id == code);
            if (find == null)
            {
                MessageBox.Show("不存在的地码,请检查");
            }
        }
    }
}