private void BTN_AddRemove_Click(object sender, RoutedEventArgs e) { CharacterRosterEditor cre = new CharacterRosterEditor(Smashers); cre.Owner = Application.Current.MainWindow; cre.ShowDialog(); FileManager.WriteFile(Smashers); Smashers = CharacterFileManager.ReadFile(); DG_Characters.ItemsSource = Smashers; }
public CharacterList() { InitializeComponent(); FileManager = new CharacterFileManager(); Smashers = new List <Character>(CharacterFileManager.ReadFile(true)); if (Smashers == null) { Smashers = new List <Character>(); } if (Smashers.Count <= 0) { UpdateCharacters(); } DG_Characters.ItemsSource = Smashers; }
// initializers public MainWindow() { InitializeComponent(); FileManager = new CharacterFileManager(); TB_Instructions.Text = "Click 'Randomize' to generate a new random list of characters."; Smashers = new List<Character>(FileManager.ReadFile()); if (Smashers == null) Smashers = new List<Character>(); if (Smashers.Count <= 0) UpdateCharacters(); DG_Characters.ItemsSource = Smashers; // hook up events UpdateTierStart += UpdateTierStartEventHandler; UpdateTierEnd += UpdateTierEndEventHandler; UpdateTierFailed += UpdateTierFailedEventHandler; }
private void BTN_AddPlayer_Click(object sender, RoutedEventArgs e) { PlayerOptions playerOptions = new PlayerOptions(CharacterFileManager.ReadFile(true)); playerOptions.Owner = Application.Current.MainWindow; playerOptions.ShowDialog(); if (playerOptions.DialogResult == true) { Player newPlayer = playerOptions.Player; if (!Contestants.Any(pc => pc.PlayerName == newPlayer.Name)) { newPlayer.Smashers = CharacterRandomizer.Randomize(CharacterFileManager.ReadFile()); PlayerCell newCell = new PlayerCell(newPlayer); SP_Contestants.Children.Add(newCell); } else { MessageBox.Show("There is already a player with this name.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
// initializers public MainWindow() { InitializeComponent(); FileManager = new CharacterFileManager(); TB_Instructions.Text = "Click 'Randomize' to generate a new random list of characters."; Smashers = new List <Character>(FileManager.ReadFile()); if (Smashers == null) { Smashers = new List <Character>(); } if (Smashers.Count <= 0) { UpdateCharacters(); } DG_Characters.ItemsSource = Smashers; // hook up events UpdateTierStart += UpdateTierStartEventHandler; UpdateTierEnd += UpdateTierEndEventHandler; UpdateTierFailed += UpdateTierFailedEventHandler; }