Exemplo n.º 1
0
 private void btnNextVol_Click(object sender, EventArgs e)
 {
     if (iterator.isNext())
     {
         iterator.Next();
         UpdateIterator();
     }
 }
Exemplo n.º 2
0
 private void tmrClock_Tick(object sender, EventArgs e)
 {
     if (!ta.Empty)
     {
         VolunteerIterator iter   = new VolunteerIterator(ta);
         Volunteer         member = iter.First();
         while (!iter.isDone())
         {
             if (member.HourOfLife())
             {
                 Log(member.GetName() + "[id:" + member.ID.ToString() + "] погибает.");
                 ta.RemoveVolunteer(iter.Index);
             }
             member = iter.Next();
         }
         UpdateIterator();
     }
 }
Exemplo n.º 3
0
 private void btnFeed_Click(object sender, EventArgs e)
 {
     if (!ckbxAll.Checked)
     {
         Output(iterator.Current().Feed());
     }
     else if (!ta.Empty)
     {
         VolunteerIterator iter   = new VolunteerIterator(ta);
         Volunteer         member = iter.First();
         while (!iter.isDone())
         {
             member.Feed();
             member = iter.Next();
         }
         Output("Все накормлены.");
     }
 }
Exemplo n.º 4
0
 private void btnRepair_Click(object sender, EventArgs e)
 {
     if (!ckbxAll.Checked)
     {
         Output(iterator.Current().Repair());
     }
     else if (!ta.Empty)
     {
         VolunteerIterator iter   = new VolunteerIterator(ta);
         Volunteer         member = iter.First();
         while (!iter.isDone())
         {
             member.Repair();
             member = iter.Next();
         }
         Output("Все отремонтированы.");
     }
 }
Exemplo n.º 5
0
        protected void UpdateIterator()
        {
            iterator.Update(ta);
            if (ta.Empty)
            {
                lblPointer.Text     = "0/0";
                pnlCommands.Enabled = false;
                btnDelete.Enabled   = false;
            }
            else
            {
                lblPointer.Text     = (iterator.Index + 1).ToString() + "/" + ta.Count.ToString();
                pnlCommands.Enabled = true;
                btnDelete.Enabled   = true;
            }



            VolunteerIterator iterator2 = new VolunteerIterator(ta, iterator.Index);

            if (!ta.Empty)
            {
                pbCurrent.Image   = iterator2.Current().Photo;
                pbCurrent.Visible = true;
            }
            else
            {
                pbCurrent.Visible = false;
            }
            if (iterator2.isNext())
            {
                pbNext.Image   = iterator2.Next().Photo;
                pbNext.Visible = true;
            }
            else
            {
                pbNext.Visible = false;
            }
            if (iterator2.isNext())
            {
                lblNext2.Visible = true;
            }
            else
            {
                lblNext2.Visible = false;
            }

            iterator2 = new VolunteerIterator(ta, iterator.Index);
            if (iterator2.isPrev())
            {
                pbPrev.Image   = iterator2.Prev().Photo;
                pbPrev.Visible = true;
            }
            else
            {
                pbPrev.Visible = false;
            }
            if (iterator2.isPrev())
            {
                lblPrev2.Visible = true;
            }
            else
            {
                lblPrev2.Visible = false;
            }
        }