public UserControlPrizeLevels() { InitializeComponent(); plsObject = new PrizeLevels(); plsID = null; //SetsUp the default 2 PrizeLevel UserControlPrizeLevel ucpl = new UserControlPrizeLevel(); ucpl.addListener(this); Prizes.Children.Add(ucpl); plsObject.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); plsObject.addPrizeLevel(ucpl2.plObject); ucpl2.plObject.prizeLevel = Prizes.Children.Count; ucpl2.CloseButton.IsEnabled = false; ucpl2.CloseButton.Opacity = 0.0f; this.Loaded += new RoutedEventHandler(UserControlPrizeLevels_Loaded); prizeLevelScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; prizeLevelCounterLabel.Content = Prizes.Children.Count; }
public UserControlPrizeLevels() { InitializeComponent(); plsObject = new PrizeLevels(); plsID = null; //SetsUp the default 2 PrizeLevel UserControlPrizeLevel ucpl = new UserControlPrizeLevel(); ucpl.addListener(this); Prizes.Children.Add(ucpl); plsObject.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); plsObject.addPrizeLevel(ucpl2.plObject); ucpl2.plObject.prizeLevel = Prizes.Children.Count; ucpl2.CloseButton.IsEnabled = false; ucpl2.CloseButton.Opacity = 0.0f; this.Loaded += new RoutedEventHandler(UserControlPrizeLevels_Loaded); prizeLevelScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; prizeLevelCounterLabel.Content = Prizes.Children.Count; }
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; if (Prizes.Children.Count >= 12) { AddButton.IsEnabled = false; AddButton.Opacity = 0.3; } }
public void Add_Prize_Level(object sender, RoutedEventArgs e) { if (plsObject.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); plsObject.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 (plsObject.getNumPrizeLevels() >= 12) { AddButton.IsEnabled = false; AddButton.Opacity = 0.3; } prizeLevelScroll.ScrollToBottom(); //Shouts the PrizeLevels object so that they can be analyzed in Divisions shout(plsObject); prizeLevelCounterLabel.Content = Prizes.Children.Count; }