private void AddNewCharacter(string character)
        {
            if (IsNullOrWhiteSpace(character))
            {
                return;
            }

            var existingItem = CurrentContextCharacters.FirstOrDefault(c => c.ToString().Equals(character, StringComparison.OrdinalIgnoreCase));

            if (existingItem != null)
            {
                m_listBoxCharacters.SelectedItem = existingItem;
                return;
            }

            using (var dlg = new NewCharacterDlg(character))
            {
                MainForm.LogDialogDisplay(dlg);
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                m_viewModel.StoreCharacterDetail(character, dlg.Gender, dlg.Age);
            }

            var newItem = new AssignCharacterViewModel.Character(character, projectSpecific: true);

            m_listBoxCharacters.Items.Add(newItem);
            m_listBoxCharacters.SelectedItem = newItem;
        }
Ejemplo n.º 2
0
        private void AddNewCharacter(string character)
        {
            if (string.IsNullOrWhiteSpace(character))
            {
                return;
            }

            var existingItem = CurrentContextCharacters.FirstOrDefault(c => c.ToString() == character);

            if (existingItem != null)
            {
                m_listBoxCharacters.SelectedItem = existingItem;
                return;
            }

            using (var dlg = new NewCharacterDlg(character))
            {
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                m_viewModel.AddCharacterDetailToProject(character, dlg.Gender, dlg.Age);
            }

            var newItem = new AssignCharacterViewModel.Character(character);

            m_listBoxCharacters.Items.Add(newItem);
            m_listBoxCharacters.SelectedItem = newItem;
        }