public VoiceActor.VoiceActor AddNewActorToGroup(string actorName, CharacterGroup group)
        {
            Debug.Assert(!group.AssignedToCameoActor);

            var actorViewModel = new VoiceActorInformationViewModel(m_project);

            if (actorViewModel.IsDuplicateActorName(null, actorName) || actorName == "Remove Voice Actor Assignment")
            {
                throw new InvalidOperationException("Attempting to add existing actor!");
            }

            var newActor = actorViewModel.AddNewActor();

            newActor.Name = actorName;
            switch (group.GroupIdLabel)
            {
            case CharacterGroup.Label.Female:
                newActor.Gender = ActorGender.Female;
                break;

            case CharacterGroup.Label.Child:
                newActor.Age = ActorAge.Child;
                break;
            }
            AssignActorToGroup(newActor.Id, group);
            actorViewModel.SaveVoiceActorInformation();
            return(newActor);
        }
Esempio n. 2
0
        private void AssignVoiceActors_Click(object sender, EventArgs e)
        {
            // TODO: Eventually, this should be called when the user requests that all overrides be reverted to the defaults.
            //m_project.UseDefaultForUnresolvedMultipleChoiceCharacters();

            if (m_project.VoiceActorStatus == VoiceActorStatus.UnProvided)
            {
                var actorInfoViewModel = new VoiceActorInformationViewModel(m_project);

                using (var dlg = new VoiceActorInformationDlg(actorInfoViewModel))
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        m_project.VoiceActorStatus = VoiceActorStatus.Provided;
                    }
                SaveCurrentProject();
            }
            else
            {
                EnsureGroupsAreInSynchWithCharactersInUse();
            }

            if (m_project.VoiceActorStatus == VoiceActorStatus.Provided)
            {
                using (var dlg = new VoiceActorAssignmentDlg(m_project))
                    dlg.ShowDialog();
                SaveCurrentProject();
            }
            UpdateDisplayOfProjectInfo();
        }
Esempio n. 3
0
        private void ShowVoiceActorList(bool keepSelection)
        {
            var actorInfoViewModel = new VoiceActorInformationViewModel(m_viewModel.Project);

            using (var actorDlg = new VoiceActorInformationDlg(actorInfoViewModel, false, false, !keepSelection))
            {
                if (actorDlg.ShowDialog(this) == DialogResult.Cancel)
                {
                    keepSelection = true;                     // Even though Cancel doesn't actually discard changes, it should at least reflect the user's desire not to have any changes result in a change to the cast size choice
                }
                m_viewModel.SetVoiceActorListValues(new CastSizeRowValues(m_viewModel.Project.VoiceActorList), keepSelection);
            }
            m_castSizePlanningOptions.Refresh();
            UpdateButtonState();
            ShowOrHideNarratorCountWarning();
        }
Esempio n. 4
0
        public VoiceActorInformationDlg(VoiceActorInformationViewModel viewModel, bool initialEntry, bool changeOkToGenerateGroups, bool enableOkButtonEvenIfNoChanges = false)
        {
            InitializeComponent();

            m_dataGrid.Saved += DataGrid_Saved;

            m_viewModel = viewModel;
            m_changeOkToGenerateGroups = changeOkToGenerateGroups;
            m_dataGrid.Initialize(m_viewModel, !initialEntry);
            if (enableOkButtonEvenIfNoChanges)
            {
                m_btnOk.Enabled = m_viewModel.ActiveActors.Any();
            }

            HandleStringsLocalized();
            LocalizeItemDlg.StringsLocalized += HandleStringsLocalized;
        }
 public void SetUp()
 {
     m_testProject.VoiceActorList.AllActors.Clear();
     m_testProject.VoiceActorList.AllActors.AddRange(new List <Glyssen.VoiceActor.VoiceActor>
     {
         new Glyssen.VoiceActor.VoiceActor {
             Id = 1, Name = "Mergat"
         },
         new Glyssen.VoiceActor.VoiceActor {
             Id = 2, Name = "Hendrick"
         },
         new Glyssen.VoiceActor.VoiceActor {
             Id = 3, Name = "Polygo"
         },
         new Glyssen.VoiceActor.VoiceActor {
             Id = 4, Name = "Imran"
         },
     });
     m_model = new VoiceActorInformationViewModel(m_testProject);
 }
        public VoiceActorInformationDlg(VoiceActorInformationViewModel viewModel, bool showNext = true)
        {
            InitializeComponent();

            m_dataGrid.Saved           += DataGrid_Saved;
            m_dataGrid.RowCountChanged += DataGrid_RowCountChanged;

            m_viewModel    = viewModel;
            m_initialEntry = showNext;
            m_dataGrid.Initialize(m_viewModel);

            m_btnNext.Visible   = showNext;
            m_linkClose.Visible = showNext;
            m_btnOk.Visible     = !showNext;

            m_linkNarrationPreferences.Links.Clear();
            m_linkNarrationPreferences.Links.Add(60, 21);

            m_linkMoreInfo.Links.Clear();
            m_linkMoreInfo.Links.Add(77, 9);

            HandleStringsLocalized();
            LocalizeItemDlg.StringsLocalized += HandleStringsLocalized;
        }