Exemplo n.º 1
0
 public void win(Greyhound winner) {
     if (m_finished) return;
     this.m_finished = true;
     try {
         m_form.TmrRender.Enabled = false;
         m_form.TmrUpdate.Enabled = false;
         MessageBox.Show($"{winner.ToString()} has won");
     } catch (Exception e) {
         MessageBox.Show(e.Message);
     }
 }
Exemplo n.º 2
0
      	public Frm_Main() {
      	    inst = this;
            InitializeComponent();
      	    m_hounds = new Greyhound[4];
      	    // Slow initialization
      	    m_hounds[0] = new Greyhound("Hound 1");
      	    System.Threading.Thread.Sleep(50);
      	    m_hounds[1] = new Greyhound("Hound 2");
      	    System.Threading.Thread.Sleep(50);
      	    m_hounds[2] = new Greyhound("Hound 3");
      	    System.Threading.Thread.Sleep(50);
      	    m_hounds[3] = new Greyhound("Hound 4");

      	    PictureBox[] pictureboxes = new PictureBox[4];
      	    pictureboxes[0] = pic_Hound1;
      	    pictureboxes[1] = pic_Hound2;
      	    pictureboxes[2] = pic_Hound3;
      	    pictureboxes[3] = pic_Hound4;

      	    pic_Hound1.Image = Properties.Resources.hound1;
      	    pic_Hound2.Image = Properties.Resources.hound2;
      	    pic_Hound3.Image = Properties.Resources.hound3;
      	    pic_Hound4.Image = Properties.Resources.hound4;

      	    m_houndBoxes = new Dictionary<PictureBox, Greyhound>();
      	    for (int i = 0; i < m_hounds.Length; i++)
      	        m_houndBoxes.Add(pictureboxes[i], m_hounds[i]);

      	    m_handler = new RaceHandler(this, pic_Background, pic_Finish, m_hounds);

      	    TmrRender.Enabled = TmrUpdate.Enabled = false;
      	    TmrRender.Interval = (int)updateInterval;
      	    TmrRender.Tick += render;
      	    TmrUpdate.Interval = (int) (updateInterval*60);
      	    TmrUpdate.Tick += update;
      	}