/// <summary> /// Games must have minimum of two prize levels, this places them with default info /// </summary> public void AddDefaultPrizeLevels() { //SetsUp the default 2 PrizeLevel UserControlPrizeLevel ucpl = new UserControlPrizeLevel(); ucpl.AddListener(this); Prizes.Children.Add(ucpl); MainWindowModel.Instance.PrizeLevelsModel.addPrizeLevel(ucpl.plObject); ucpl.plObject.prizeLevel = 1; ucpl.CloseButton.IsEnabled = false; ucpl.CloseButton.Opacity = 0.0f; UserControlPrizeLevel ucpl2 = new UserControlPrizeLevel(); ucpl2.OuterGrid.Margin = new Thickness(0, Prizes.Children.Count * MARGIN, 0, 0); ucpl2.AddListener(this); Prizes.Children.Add(ucpl2); MainWindowModel.Instance.PrizeLevelsModel.addPrizeLevel(ucpl2.plObject); ucpl2.plObject.prizeLevel = Prizes.Children.Count; ucpl2.CloseButton.IsEnabled = false; ucpl2.CloseButton.Opacity = 0.0f; }
/// <summary> /// Adds a new prize level /// </summary> /// <param name="sender">GUI object that sent the event</param> /// <param name="e"></param> public void Add_Prize_Level(object sender, RoutedEventArgs e) { if (MainWindowModel.Instance.PrizeLevelsModel.getNumPrizeLevels() < 12) { UserControlPrizeLevel ucpl = new UserControlPrizeLevel(); ucpl.OuterGrid.Margin = new Thickness(0, Prizes.Children.Count * MARGIN, 0, 0); ucpl.AddListener(this); Prizes.Children.Add(ucpl); MainWindowModel.Instance.PrizeLevelsModel.addPrizeLevel(ucpl.plObject); ucpl.plObject.prizeLevel = Prizes.Children.Count; //adds the PrizeLevel to the end } //Gets rid of any highlight of previously selected PrizeLevel for (int i = 0; i < Prizes.Children.Count; i++) { UserControlPrizeLevel ucpl = (UserControlPrizeLevel)Prizes.Children[i]; //ucpl.LevelGrid.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("LightGray")); ucpl.OuterGrid.Margin = new Thickness(0, i * MARGIN, 0, 0); ucpl.plObject.prizeLevel = (i + 1); ucpl.CloseButton.IsEnabled = true; ucpl.CloseButton.Opacity = 1; } if (MainWindowModel.Instance.PrizeLevelsModel.getNumPrizeLevels() == 12) { AddButton.IsEnabled = false; AddButton.Opacity = 0.3; } prizeLevelScroll.ScrollToBottom(); prizeLevelCounterLabel.Content = Prizes.Children.Count; MainWindowModel.Instance.VerifyNumTiles(); MainWindowModel.Instance.VerifyDivisions(); //Shouts the PrizeLevels object so that they can be analyzed in Divisions Shout(MainWindowModel.Instance.PrizeLevelsModel); }
/// <summary> /// Attach data from loadedPrizeLevel to prize level /// </summary> /// <param name="loadedPrizeLevel">Prize Level from the loaded project</param> public void loadExistingPrizeLevel(PrizeLevel loadedPrizeLevel) { UserControlPrizeLevel ucpl = new UserControlPrizeLevel(); ucpl.OuterGrid.Margin = new Thickness(0, Prizes.Children.Count * MARGIN, 0, 0); ucpl.AddListener(this); Prizes.Children.Add(ucpl); ucpl.plObject = loadedPrizeLevel; ucpl.plObject.initializeListener(); ucpl.setDataContext(); ucpl.plObject.prizeLevel = Prizes.Children.Count; prizeLevelCounterLabel.Content = Prizes.Children.Count; }