/// <summary> /// A button event that clears the division of selected prize levels /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void clearDivisionButton_Click(object sender, RoutedEventArgs e) { DivModel.clearPrizeLevelList(); for (int i = 0; i < DivisionModel.MAX_PRIZE_BOXES; i++) { DivModel.levelBoxes[i].IsSelected = false; } DivModel.TotalPlayerPicks = DivModel.calculateTotalCollections(); DivModel.TotalPrizeValue = DivModel.calculateDivisionValue(); SectionContainer.validateDivision(); }
/// <summary> /// Updates the total player picks and total value based on the selected prize levels /// </summary> public void updateInfo() { if (Prizes.getNumPrizeLevels() > 0) { DivModel.clearPrizeLevelList(); for (int i = 0; i < Prizes.getNumPrizeLevels(); i++) { if (DivModel.levelBoxes[i].IsSelected) { DivModel.addPrizeLevel(Prizes.getPrizeLevel(i)); } } DivModel.TotalPlayerPicks = DivModel.calculateTotalCollections(); DivModel.TotalPrizeValue = DivModel.calculateDivisionValue(); } SectionContainer.validateDivision(); }
/// <summary> /// Updates all of the info and prize level box data in the division /// </summary> public void updateDivision() { if (Prizes.getNumPrizeLevels() > 0) { for (int i = 0; i < DivisionModel.MAX_PRIZE_BOXES; i++) { if (DivModel.levelBoxes[i].IsAvailable && DivModel.levelBoxes[i].IsSelected) { DivModel.addPrizeLevel(Prizes.getPrizeLevel(i)); } else { DivModel.levelBoxes[i].IsSelected = false; } } DivModel.TotalPlayerPicks = DivModel.calculateTotalCollections(); DivModel.TotalPrizeValue = DivModel.calculateDivisionValue(); } }