public void InitializeWorkplaceComponents() { foreach (Workplace w in Model.Workplaces) { WorkplaceControl wc = new WorkplaceControl(w); wc.Parent = this.workPanel; wc.Width = 90; wc.Height = 90; wc.Location = new Point(w.Location.X - wc.Width / 2, w.Location.Y - wc.Height / 2); this.workPanel.Controls.Add(wc); wc.Show(); } StartControl = new StartControl(); StartControl.Parent = this.workPanel; StartControl.Width = 70; StartControl.Height = 70; StartControl.Location = new Point(Model.StartLocation.X - StartControl.Width/2, Model.StartLocation.Y - StartControl.Height/2); StartControl.Show(); EndControls = new EndControl[Model.EndCount]; for (int i = 0; i < Model.EndCount; i++) { EndControls[i] = new EndControl(i); EndControls[i].Parent = this.workPanel; EndControls[i].Width = 70; EndControls[i].Height = 70; EndControls[i].Location = new Point(Model.EndPoints[i].Location.X - EndControls[i].Width/2, Model.EndPoints[i].Location.Y - EndControls[i].Height /2); } foreach (Swapspace swapspace in Model.Swapspaces) { SwapspaceControl swap = new SwapspaceControl(swapspace); swap.Width = 90; swap.Height = 90; swap.Parent = this.workPanel; swap.Location = new Point(swapspace.Location.X - swap.Width / 2, swapspace.Location.Y - swap.Height / 2); this.workPanel.Controls.Add(swap); swap.Show(); } CarrierControl = new CarrierControl(); CarrierControl.Parent = this.workPanel; CarrierControl.Width = 50; CarrierControl.Height = 50; CarrierControl.Location = new Point(Model.CarrierPositionP.X - CarrierControl.Width / 2, Model.CarrierPositionP.Y - CarrierControl.Height / 2); CarrierControl.Show(); Model.CarrierPositionChanged += new EventHandler(CarrierPositionChanged); }
public void InitializeWorkplaceComponents() { foreach (Workplace w in Model.Workplaces) { WorkplaceControl wc = new WorkplaceControl(w); wc.Parent = this.workPanel; wc.Width = 90; wc.Height = 90; wc.Location = new Point(w.Location.X - wc.Width / 2, w.Location.Y - wc.Height / 2); this.workPanel.Controls.Add(wc); wc.Show(); } StartControl = new StartControl(); StartControl.Parent = this.workPanel; StartControl.Width = 70; StartControl.Height = 70; StartControl.Location = new Point(Model.StartLocation.X - StartControl.Width / 2, Model.StartLocation.Y - StartControl.Height / 2); StartControl.Show(); EndControls = new EndControl[Model.EndCount]; for (int i = 0; i < Model.EndCount; i++) { EndControls[i] = new EndControl(i); EndControls[i].Parent = this.workPanel; EndControls[i].Width = 70; EndControls[i].Height = 70; EndControls[i].Location = new Point(Model.EndPoints[i].Location.X - EndControls[i].Width / 2, Model.EndPoints[i].Location.Y - EndControls[i].Height / 2); } foreach (Swapspace swapspace in Model.Swapspaces) { SwapspaceControl swap = new SwapspaceControl(swapspace); swap.Width = 90; swap.Height = 90; swap.Parent = this.workPanel; swap.Location = new Point(swapspace.Location.X - swap.Width / 2, swapspace.Location.Y - swap.Height / 2); this.workPanel.Controls.Add(swap); swap.Show(); } CarrierControl = new CarrierControl(); CarrierControl.Parent = this.workPanel; CarrierControl.Width = 50; CarrierControl.Height = 50; CarrierControl.Location = new Point(Model.CarrierPositionP.X - CarrierControl.Width / 2, Model.CarrierPositionP.Y - CarrierControl.Height / 2); CarrierControl.Show(); Model.CarrierPositionChanged += new EventHandler(CarrierPositionChanged); }