private void RenameButton_Click(object sender, RoutedEventArgs e) { if (ListBox.SelectedItem != null) { string SelectedPokemonName = ListBox.SelectedItem.ToString(); Rename_Input newWindow = new Rename_Input(SelectedPokemonName); newWindow.ShowDialog(); string newName = newWindow.Name; foreach (Pokemon X in Pokemons) { if (X.Name == SelectedPokemonName) { string temp = X.Name; X.SecondName = newName; ListBox.Items.Refresh(); DisplayPokemon(X); AddInfo("\nPixelmon " + temp + " has change its name into " + X.Name); } } } else { AddInfo("Please select and click a pixelmon."); MessageBox.Show("Ops. Please select and click a pixelmon."); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Rename_Input1 = ((Pokemon_3080.Rename_Input)(target)); return; case 2: this.TextBox = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.textBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.button = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\Rename_Input.xaml" this.button.Click += new System.Windows.RoutedEventHandler(this.button_Click); #line default #line hidden return; } this._contentLoaded = true; }