public bool LoadWorkspace(Workspace ws) { if (ws.WorkShapeList.Count < 1) { return(false); } foreach (SectionBar sb in ws.WorkShapeList) { sb.Load(); } ActiveWorkShape = ws.WorkShapeList[0]; ActiveWorkspace = ws; OnModelChanged(EnumModelType.MT_WorkShape, EnumDataChange.DC_ADD); foreach (MachineTask task in ws.TaskList) { TaskModel.CurrentTask = task; OnModelChanged(EnumModelType.MT_Task, EnumDataChange.DC_ADD); } if (KnifeShape == null) { KnifeShape = new KnifeToolShape(); KnifeShape.UpdateKnifeTool(ActiveKnifeTool); OnModelChanged(EnumModelType.MT_KnifeTool, EnumDataChange.DC_ADD); } return(true); }
public override bool LoadWorkShape(string fileName, string barName) { SectionBar sb = new SectionBar(); sb.FileName = fileName; sb.Name = barName; sb.Length = this.SectionBarLength; sb.StartWH.X = this.SxW; sb.StartWH.Y = this.SxH; sb.EndWH.X = this.DxW; sb.EndWH.Y = this.DxH; if (!sb.Load()) { return(false); } ActiveWorkspace.AddWorkShape(sb); ActiveWorkShape = sb; SxW = (long)sb.StartWH.X; SxH = (long)sb.StartWH.Y; DxW = (long)sb.EndWH.X; DxH = (long)sb.EndWH.Y; SectionBarLength = (long)sb.Length; OnModelChanged(EnumModelType.MT_WorkShape, EnumDataChange.DC_ADD); if (KnifeShape == null) { KnifeShape = new KnifeToolShape(); KnifeShape.UpdateKnifeTool(ActiveKnifeTool); OnModelChanged(EnumModelType.MT_KnifeTool, EnumDataChange.DC_ADD); } return(true); }