Esempio n. 1
0
        private void SetScore(int factor, DartbordEventArgs e)
        {
            var edFactor =
                (EnumerateControls().Single(c => c.Name == "edFactor" + e.Throw.ToString(CultureInfo.InvariantCulture)) as
                 NumericUpDown);
            var edThrow =
                (EnumerateControls().Single(c => c.Name == "edThrow" + e.Throw.ToString(CultureInfo.InvariantCulture)) as
                 NumericUpDown);

            if (edFactor != null)
            {
                edFactor.Value = factor;
            }
            if (edThrow != null)
            {
                if (factor == 0)
                {
                    edThrow.Value = 0;
                }
                else
                {
                    // ReSharper disable once PossibleLossOfFraction
                    edThrow.Value = e.Score / factor;
                }
            }
        }
Esempio n. 2
0
 protected virtual void OnTripleThrown(DartbordEventArgs e)
 {
     if (TripleThrown != null)
     {
         TripleThrown(this, e);
     }
 }
Esempio n. 3
0
 protected virtual void OnDoubleThrown(DartbordEventArgs e)
 {
     if (DoubleThrown != null)
     {
         DoubleThrown(this, e);
     }
 }
Esempio n. 4
0
 protected virtual void OnSingleThrown(DartbordEventArgs e)
 {
     if (SingleThrown != null)
     {
         SingleThrown(this, e);
     }
 }
Esempio n. 5
0
 protected virtual void OnNoScoreThrown(DartbordEventArgs e)
 {
     if (NoScoreThrown != null)
     {
         NoScoreThrown(this, e);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// This ControlActions region shows all the eventhandlers for the controls
        /// </summary>
        #region ControlActions
        private void picDartbord_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            try
            {
                int posX = (e.X - (Width / 2));
                int posY = ((Height / 2) - e.Y);

                mintScore = GetScore(posX, posY);

                //Raise the event(s)
                DartbordEventArgs dea = new DartbordEventArgs(mintScore, mstrScoreText, mintThrow);

                if (mIsTriple)
                {
                    OnTripleThrown(dea);
                }
                if (mIsDouble)
                {
                    OnDoubleThrown(dea);
                }
                if (mIsSingle)
                {
                    OnSingleThrown(dea);
                }
                if (mIsNoScore)
                {
                    OnNoScoreThrown(dea);
                }

                mintThrow++;
                if (mintThrow == 4)
                {
                    mintThrow = 1;
                }
                lblThrowNum.Text = mintThrow.ToString();
            }
            catch
            {
                throw;
            }
        }
Esempio n. 7
0
 private void ctlDartbord1_TripleThrown(object sender, DartbordEventArgs e)
 {
     SetScore(3, e);
 }
Esempio n. 8
0
 private void ctlDartbord1_NoScoreThrown(object sender, DartbordEventArgs e)
 {
     SetScore(1, e);
 }
Esempio n. 9
0
 private void ctlDartbord1_DoubleThrown(object sender, DartbordEventArgs e)
 {
     SetScore(2, e);
 }