public Node AddNode(string buildType) { switch (buildType) { case "Conveyor": Conveyor co = new Conveyor(); conveyors.Add(co); return(co); case "CheckIn": CheckIn ch = new CheckIn(); checkIns.Add(ch); return(ch); case "DropOff": DropOff dr = new DropOff(); dropOffs.Add(dr); return(dr); case "Branch": BranchingConveyor br = new BranchingConveyor(); branchingConveyors.Add(br); return(br); } return(null); }
private void BtnFlightToDropOff_Click(object sender, EventArgs e) { if (cmBoxNodeFlights.SelectedItem != null) { DropOff d = selectedTile.nodeInGrid as DropOff; Flight f = cmBoxNodeFlights.SelectedItem as Flight; d.FlightID = f.FlightID; InfoDisplayer(selectedTile); } }
public Form1() { InitializeComponent(); grBoxBuildType.Visible = false; cmBoxNodeFlights.Visible = false; listBNodeInfoList.Visible = false; btnFlightToCheckIn.Visible = false; btnFlightToDropOff.Visible = false; lblDropOffFLID.Visible = false; thisGrid = new Grid(animationBox.Width, animationBox.Height); thisEngine = new Engine(); pathFinder = new PathFinder(); flightManager = new FlightManager(); buildType = "Conveyor"; isBuildingConveyor = false; isConnecting = false; System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(TimerSequence); aTimer.Interval = 1000; aTimer.Enabled = true; GridTile t = thisGrid.FindTileInRowColumnCoordinates(0, 0); t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType); t = thisGrid.FindTileInRowColumnCoordinates(0, 1); t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType); t = thisGrid.FindTileInRowColumnCoordinates(0, 2); t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType); t = thisGrid.FindTileInRowColumnCoordinates(0, 3); t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType); t = thisGrid.FindTileInRowColumnCoordinates(1, 3); t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType); t = thisGrid.FindTileInRowColumnCoordinates(2, 3); t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode(buildType), buildType); t = thisGrid.FindTileInRowColumnCoordinates(8, 8); t = thisGrid.AddTileAtCoordinates(t, thisEngine.AddNode("DropOff"), "DropOff"); DropOffTile d = t as DropOffTile; DropOff dd = d.nodeInGrid as DropOff; dd.FlightID = 111; Conveyor c = thisEngine.firstConveyor(); c.baggageHeld = new Baggage(111); List <Conveyor> conveyors = thisEngine.GetConveyors(); for (int i = 0; i < conveyors.Count - 1; i++) { thisEngine.ConnectNodes(conveyors[i], conveyors[i + 1]); } }
private void DropOffInfoDisplayer(DropOff d) { lblDropOffFLID.Text = Convert.ToString(d.FlightID); List <Flight> filter = flightManager.GetFlights().ToList(); foreach (Flight look in filter.ToList()) { if (look.FlightID == d.FlightID) { filter.Remove(look); break; } } cmBoxNodeFlights.Items.Clear(); foreach (Flight f in filter) { cmBoxNodeFlights.Items.Add(f); } }
private void BtnTest_Click(object sender, EventArgs e) { //MessageBox.Show(thisGrid.GetBranches(thisEngine.GetBranchesCount()).Count() + ""); //BranchingConveyor b = selectedTile.nodeInGrid as BranchingConveyor; //MessageBox.Show(b.ReturnNextsDic().Count() + ""); //string z = " "; //foreach(var v in b.ReturnNextsDic()) //{ // z = z + " " + v.Key; //} //MessageBox.Show(z); DropOff d = selectedTile.nodeInGrid as DropOff; testList.Items.Clear(); foreach (var b in d.ReturnBaggages()) { testList.Items.Add(b.flightID); } }
public int FindFinalDropOff(Node starter, int id) { if (id != 0) { return(id); } if (starter.nextNode is DropOff) { DropOff d = starter.nextNode as DropOff; id = d.FlightID; return(id); } if (starter.nextNode == null) { return(0); } if (starter.nextNode != null) { id = FindFinalDropOff(starter.nextNode, id); } return(id); }