private void OnDeleteCharacter(object parameter)
        {
            if (parameter == null || !CanDeleteCharacter(parameter))
            {
                return;
            }

            if (m_deletionDialog != null && m_deletionDialog.Visibility == Visibility.Visible)
            {
                m_deletionDialog.Close();
            }

            var character = (CharactersListEntry)parameter;

            if (character.Level >= 20)
            {
                m_deletionDialog = new DeletionDialog();
                m_deletionDialog.CharacterName  = character.Name;
                m_deletionDialog.SecretQuestion = Bot.ClientInformations.SecretQuestion;

                if (m_deletionDialog.ShowDialog() == true)
                {
                    Bot.SendToServer(new CharacterDeletionRequestMessage(character.Id, Cryptography.GetMD5Hash(character.Id + "~" + m_deletionDialog.SecretAnswer)));
                }
            }
            else if (MessageService.ShowYesNoQuestion(View, string.Format("Are you sure you want to delete {0} ?", character.Name)))
            {
                Bot.SendToServer(new CharacterDeletionRequestMessage(character.Id, Cryptography.GetMD5Hash(character.Id + "~" + "000000000000000000")));
            }
        }
        public override void OnDetached()
        {
            base.OnDetached();

            var viewModel = Bot.GetViewModel();

            viewModel.RemoveDocument(View);

            if (m_deletionDialog != null && m_deletionDialog.Visibility == Visibility.Visible)
            {
                View.Dispatcher.Invoke(new Action(m_deletionDialog.Close));
                m_deletionDialog = null;
            }

            if (m_characterCreationDialog != null && m_characterCreationDialog.Visibility == Visibility.Visible)
            {
                View.Dispatcher.Invoke(new Action(m_characterCreationDialog.Close));
                m_characterCreationDialog = null;
            }
        }