/// <summary>
        /// Generates the random item ID and bonus info.
        /// </summary>
        /// <param name="minType">Minimum item ID.</param>
        /// <param name="maxType">Maximum item ID.</param>
        /// <param name="bonusProbability">Probability of the bonus.</param>
        public void GenerateNew(int min, int max, float bonusProbability = 0.02f)
        {
            type = Random.Range(min, max);

            isBonus = Random.value > (1.0f - bonusProbability);
            if (isBonus) {
                bonusInfo = new BonusInfo(BonusInfo.BonusShape.Cross, 3, 3); // 3 from each side (12 in total)
            }
        }
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     BonusInfo bonus = new BonusInfo();
     bonus.BackPct = sliderBonus.Value;
     bonus.PlayTypeID = PlayTypeID;
     bonus.UserID = App.Session[Constant.USERNAME_SESSION].ToString();
     bonus.LotteryTypeID = (int)lotteryType;
     bonus.PlayTypeRadioID = MainPage.playTypeRadio;
     if (bonus.BackPct == BonusPct)
     { }
     else
     {
         gridMain.Visibility = Visibility.Collapsed;
         gridLoading.Visibility = Visibility.Visible;
         srv.UpdateBonusAsync(bonus);
         srv.UpdateBonusCompleted += new EventHandler<UpdateBonusCompletedEventArgs>(srv_UpdateBonusCompleted);
     }
     //this.DialogResult = true;
 }