コード例 #1
0
ファイル: Form1.cs プロジェクト: GalinKarafiziev/AirPortal
        public void startCheckIn1(DropOff dr)
        {
            UpdateComboBoxes();
            CreateCheckIn1(dr);
            airport.AssignTimerToBags(1, dr);
            //CheckIn checkIn1;
            //checkIn1 = new CheckIn(dr, "checkIn1", 1);
            //airport.addCheckin(checkIn1);
            //Conveyor conveyor1 = new Conveyor(dr, "conv1");
            //Conveyor conveyor2 = new Conveyor(dr, "conv2");
            //checkIn1.Point = new Point(205, 0);
            //LinkedList link1 = new LinkedList();
            //C1 = new CreateLinkList(link1, checkIn1, conveyor1, conveyor2, mpa, dr);
            //btnStart.Enabled = false;
            //comboBox1.Enabled = false;
            //lbDrop1.Text = dr.Name;

            bool more50 = MoreThen50Bags(dr, 1);

            if (more50 == false)
            {
                CheckIn1Timer.Tag      = dr;
                CheckIn1Timer.Interval = 1;
                CheckIn1Timer.Start();
            }

            //CheckIn checkIn2 = new CheckIn(dr, "checkIn2", 2);
            //airport.addCheckin(checkIn2);
            //checkIn2.Point = new Point(525, 0);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: GalinKarafiziev/AirPortal
        private void btnBreak_Click(object sender, EventArgs e)
        {
            if (CheckIn1Timer.Enabled == false)
            {
                CheckIn1Timer.Interval = 1;
                CheckIn1Timer.Start();

                if (btnCheckIn2.Enabled == false)
                {
                    CheckIn2Timer.Interval = 1;
                    CheckIn2Timer.Start();
                }

                if (btnCheckIn3.Enabled == false)
                {
                    CheckIn3Timer.Interval = 1;
                    CheckIn3Timer.Start();
                }
                if (btnCheckIn4.Enabled == false)
                {
                    CheckIn4Timer.Interval = 1;
                    CheckIn4Timer.Start();
                }
            }
            else
            {
                CheckIn1Timer.Enabled = true;
                CheckIn1Timer.Stop();

                if (btnCheckIn2.Enabled == false)
                {
                    CheckIn2Timer.Enabled = true;
                    CheckIn2Timer.Stop();
                }

                if (btnCheckIn3.Enabled == false)
                {
                    CheckIn3Timer.Enabled = true;
                    CheckIn3Timer.Stop();
                }

                if (btnCheckIn4.Enabled == false)
                {
                    CheckIn4Timer.Enabled = true;
                    CheckIn4Timer.Stop();
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: GalinKarafiziev/AirPortal
        //if checkin has more then 50bags try to make use of another checkin
        public bool MoreThen50Bags(DropOff d, int checkInNum)
        {
            bool x    = false;
            int  bags = airport.getBagByDropOff(d).Count();

            //if bags are less then 10 then just return
            if (bags < 10)
            {
                return(x);
            }

            // check which checkin is not used
            if (btnCheckIn2.Enabled == true)
            {
                //use checkin2 as well
                if (MessageBox.Show("Make use of checkIn2 for " + d.Name, "Are you sure ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    // user clicked yes
                    x        = true;
                    d.UsedBy = 2;
                    //CheckIn maincheck = airport.GetCheckInById(checkInNum);
                    CreateCheckIn2(d);

                    //CheckIn checkIn2;
                    //checkIn2 = new CheckIn(d, "checkIn2", 2);
                    //airport.addCheckin(checkIn2);
                    //Conveyor conveyor3 = new Conveyor(d, "conv3");
                    //Conveyor conveyor4 = new Conveyor(d, "conv4");
                    //checkIn2.Point = new Point(365, 0);
                    //LinkedList link2 = new LinkedList();
                    //C2 = new CreateLinkList(link2, checkIn2, conveyor3, conveyor4, mpa, d);
                    //btnCheckIn2.Enabled = false;
                    //comboBox2.Enabled = false;
                    //lbDrop2.Text = d.Name;
                    //removeDropFromComboBoxs(d.Number);

                    airport.DevideBetween2Checks(d, checkInNum, 2);

                    CheckIn1Timer.Tag      = d;
                    CheckIn1Timer.Interval = 1;
                    CheckIn1Timer.Start();

                    CheckIn2Timer.Tag      = d;
                    CheckIn2Timer.Interval = 1;
                    CheckIn2Timer.Start();
                }
            }
            else if (btnCheckIn3.Enabled == true)
            {
                //use checkin2 as well
                if (MessageBox.Show("Make use of checkIn3 for " + d.Name, "Are you sure ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    // user clicked yes
                    x        = true;
                    d.UsedBy = 3;

                    CreateCheckIn3(d);

                    //CheckIn checkIn3 = new CheckIn(d, "checkIn3", 3);
                    //airport.addCheckin(checkIn3);

                    //Conveyor conveyor5 = new Conveyor(d, "conv5");
                    //Conveyor conveyor6 = new Conveyor(d, "conv6");
                    //checkIn3.Point = new Point(525, 0);
                    //LinkedList link3 = new LinkedList();
                    //C3 = new CreateLinkList(link3, checkIn3, conveyor5, conveyor6, mpa, d);
                    //btnCheckIn3.Enabled = false;
                    //comboBox3.Enabled = false;
                    //lbDrop3.Text = d.Name;


                    airport.DevideBetween2Checks(d, checkInNum, 3);
                    CheckIn3Timer.Tag      = d;
                    CheckIn3Timer.Interval = 1;
                    CheckIn3Timer.Start();
                }
            }
            else if (btnCheckIn4.Enabled == true)
            {
                //use checkin2 as well
                if (MessageBox.Show("Make use of checkIn4 for " + d.Name, "Are you sure ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    // user clicked yes
                    x        = true;
                    d.UsedBy = 4;
                    CreateCheckIn4(d);

                    //CheckIn checkIn4 = new CheckIn(d, "checkIn4", 4);
                    //airport.addCheckin(checkIn4);
                    //Conveyor conveyor7 = new Conveyor(d, "conv7");
                    //Conveyor conveyor8 = new Conveyor(d, "conv8");
                    //checkIn4.Point = new Point(685, 0);
                    //LinkedList link4 = new LinkedList();
                    //C4 = new CreateLinkList(link4, checkIn4, conveyor7, conveyor8, mpa, d);

                    //btnCheckIn4.Enabled = false;
                    //comboBox4.Enabled = false;
                    //lbDrop4.Text = d.Name;



                    airport.DevideBetween2Checks(d, checkInNum, 4);
                    CheckIn4Timer.Tag      = d;
                    CheckIn4Timer.Interval = 1;
                    CheckIn4Timer.Start();
                }
            }
            else
            {
                return(false);
            }


            return(x);
        }