コード例 #1
0
        public static bool?ShowDialog(Window owner, IPokemon pokemon)
        {
            ChangeNicknameWindow window = new ChangeNicknameWindow(pokemon);

            window.Owner = owner;
            return(window.ShowDialog());
        }
コード例 #2
0
        private void OnChangeNicknameClicked(object sender, RoutedEventArgs e)
        {
            labelNickname.Content = pokemon.Nickname;
            string result = ChangeNicknameWindow.ShowDialog(Window.GetWindow(this), pokemon.Nickname);

            if (result != null)
            {
                if (result == "")
                {
                    pokemon.RemoveNickname();
                }
                else
                {
                    pokemon.Nickname = result;
                }
                labelNickname.Content = pokemon.Nickname;
            }
        }