public static int? ShowDialog(Window owner, int gameIndex) { SendPokeblockToWindow window = new SendPokeblockToWindow(gameIndex); window.Owner = owner; var result = window.ShowDialog(); if (result != null && result.Value) { return window.gameIndex; } return null; }
public static int?ShowDialog(Window owner, int gameIndex) { SendPokeblockToWindow window = new SendPokeblockToWindow(gameIndex); window.Owner = owner; var result = window.ShowDialog(); if (result != null && result.Value) { return(window.gameIndex); } return(null); }
private void OnPokeblockSendTo(object sender, EventArgs e) { int?result = SendPokeblockToWindow.ShowDialog(Window.GetWindow(this), blockCase.Inventory.GameIndex); if (result != null) { if (HasSelection) { bool noRoom = false; foreach (Pokeblock block in SelectedBlocks) { if (PokeManager.GetGameSaveAt(result.Value).Inventory.Pokeblocks.HasRoomForPokeblock) { PokeManager.GetGameSaveAt(result.Value).Inventory.Pokeblocks.AddPokeblock(block); blockCase.TossPokeblockAt(blockCase.IndexOf(block)); } else { noRoom = true; } } if (noRoom) { TriggerMessageBox.Show(Window.GetWindow(this), "The Pokéblock Case filled up before all of the selection could be sent", "No Room"); } } else { if (PokeManager.GetGameSaveAt(result.Value).Inventory.Pokeblocks.HasRoomForPokeblock) { PokeManager.GetGameSaveAt(result.Value).Inventory.Pokeblocks.AddPokeblock(selectedBlock); blockCase.TossPokeblockAt(selectedIndex); } else { // No room for item TriggerMessageBox.Show(Window.GetWindow(this), "No room for that Pokéblock", "No Room"); } } } }