//private void NewStyles() //{ // if (styleAddInput.Text != string.Empty) // { // List<string> splitList = styleAddInput.Text.ToUpper().Split(';', ',').Select(p => p.Trim()).ToList(); // foreach (string styl in splitList) // { // bool alreadyExists = false; // for (int i = 0; i < localStyleList.Count; i++) // { // if (localStyleList[i].style == styl) // { // alreadyExists = true; // selectedGame.style.Add(localStyleList[i]); // selectedGame.styleListToString += styl + " ; "; // break; // } // } // if (!alreadyExists) // { // Style newStyle = new Style(); // newStyle.style = styl; // newStyleList.Add(newStyle); // selectedGame.style.Add(newStyle); // selectedGame.styleListToString += styl + " ; "; // } // } // } //} private void deleteExpansion_Click(object sender, RoutedEventArgs e) { ConfirmWindow confirm = new ConfirmWindow(); confirm.WindowStartupLocation = WindowStartupLocation.CenterScreen; var result = confirm.ShowDialog(); if (result == DialogResult.HasValue) { if (confirm.isOK) { Expansion selectedExpansion = (Expansion)(sender as Button).DataContext; selectedGame.removeExpansion(selectedExpansion); } } ExpansionList.Items.Refresh(); }
private void modifyExpansion_Click(object sender, RoutedEventArgs e) { Expansion selectedExpansion = (Expansion)(sender as Button).DataContext; GameInfos InfoWindow = new GameInfos(); InfoWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; InfoWindow.Height = 300; InfoWindow.Ok_Button.Visibility = Visibility.Collapsed; InfoWindow.Ok_Button_Expansion.Visibility = Visibility.Visible; InfoWindow.Row5Grid.Visibility = Visibility.Collapsed; InfoWindow.durationTextBlock.Visibility = Visibility.Collapsed; InfoWindow.durationGrid.Visibility = Visibility.Collapsed; InfoWindow.selectedExpansion = selectedExpansion; InfoWindow.MaxPlayers.Text = selectedExpansion.maxPlayers.ToString(); InfoWindow.minPlayers.Text = selectedExpansion.minPlayers.ToString(); InfoWindow.Title.Text = selectedExpansion.title; InfoWindow.ShowDialog(); ExpansionList.Items.Refresh(); }
public void removeExpansion(Expansion expansion) { nbExpansions--; expansionList.Remove(expansion); }