FrmNeighboor.cs 1.3 KB
using CtuDeviceLib;
using System;
using System.Windows.Forms;

namespace ConveyorLine
{
    public partial class FrmNeighboor : Form
    {
        public FrmNeighboor(int angle)
        {
            InitializeComponent();
            numAngle.Value = angle;
        }
        public LandmarkNeighboor LandmarkNeighboor
        {
            get { return landmarkNeighboor; }
            set
            {
                landmarkNeighboor = value;
                updateInfo();
            }
        }
        LandmarkNeighboor landmarkNeighboor;
        void updateInfo()
        {
            if (landmarkNeighboor == null) return;
            numPointCode.Value = landmarkNeighboor.Id;
            numAngle.Value = landmarkNeighboor.Andle;
            numDis.Value = landmarkNeighboor.Distance;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (landmarkNeighboor == null)
                landmarkNeighboor = new LandmarkNeighboor();
            landmarkNeighboor.Id = (uint)numPointCode.Value;
            landmarkNeighboor.Andle = (short)numAngle.Value;
            landmarkNeighboor.Distance = (short)numDis.Value;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            landmarkNeighboor = null;
            this.Close();
        }
    }
}