using Rs.Controls; using Rs.Framework; using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rs.MotionPlat.Commom { public class TrayPosition { private int m_row = 26; private int m_column = 10; private TrayPosition() { //for (int i = 0; i < m_row; i++) //{ // for(int j=0;j SlotPoints { get; set; } = new BindingList(); public bool Save() { try { float offsetX = Math.Abs(LeftTop.X - RightBottom.X)/(m_column-1); float offsetY = Math.Abs(LeftTop.Y - LeftBottom.Y)/(m_row-1); int index = 0; SlotPoints.Clear(); for (int i = 0; i < m_column; i++) { for (int j = 0; j < m_row; j++) { index++; TraySlot ts = new TraySlot(); ts.Index = index; ts.Row = i + 1; ts.Column = j + 1; ts.Position = new PointF(LeftTop.X + (i * offsetX), LeftTop.Y + (j * offsetY)); SlotPoints.Add(ts); } } XmlSerializerHelper.Instance.Serialize($"Recipe/{TrayName}.xml", this); } catch (Exception) { return false; } return true; } public static TrayPosition Load(string trayName) { XmlSerializerHelper.Instance.Deserialize($"Recipe/{trayName}.xml",out TrayPosition entity); if (entity == null) return new TrayPosition(26,10, trayName); return entity; } } }