Exemplo n.º 1
0
        private void EnsureGroupsAreInSynchWithCharactersInUse()
        {
            if (!m_project.CharacterGroupList.CharacterGroups.Any())
            {
                return;
            }

            var adjuster = new CharacterGroupsAdjuster(m_project);

            if (adjuster.GroupsAreNotInSynchWithData)
            {
                using (var progressDialog = new GenerateGroupsProgressDialog(m_project, OnGenerateGroupsWorkerDoWork, false, true))
                {
                    var generator = new CharacterGroupGenerator(m_project, ProjectCastSizePlanningViewModel.SelectedCastSize, progressDialog.BackgroundWorker);
                    progressDialog.ProgressState.Arguments = generator;

                    if (progressDialog.ShowDialog() == DialogResult.OK && generator.GeneratedGroups != null)
                    {
                        var assignedBefore = m_project.CharacterGroupList.CountVoiceActorsAssigned();
                        generator.ApplyGeneratedGroupsToProject();

                        if (m_project.CharacterGroupList.CountVoiceActorsAssigned() < assignedBefore)
                        {
                            var msg = LocalizationManager.GetString("MainForm.FewerAssignedActorsAfterGeneration",
                                                                    "An actor assignment had to be removed. Please review the Voice Actor assignments, and adjust where necessary.");
                            MessageBox.Show(this, msg, Text, MessageBoxButtons.OK);
                        }
                    }
                    else
                    {
                        adjuster.MakeMinimalAdjustments();
                    }

                    m_project.Save(true);
                }
            }
            // This is for the migration of old projects.
            // ENHANCE; Theoretically, we could, before we update the controlfileversion number, set a flag
            // letting us know if this needs to run or not. It would be for any number < 96.
            // This method would be moved into Project (which maybe it should be anyway).
            // But this must be called only AFTER EnsureGroupsAreInSynchWithCharactersInUse has been run.
            if (m_project.CharacterGroupList.CharacterGroups.Any(g => g.GroupIdLabel == CharacterGroup.Label.None))
            {
                CharacterGroupList.AssignGroupIds(m_project.CharacterGroupList.CharacterGroups);
            }
        }
Exemplo n.º 2
0
        private void EnsureGroupsAreInSynchWithCharactersInUse()
        {
            if (!m_project.CharacterGroupList.CharacterGroups.Any())
            {
                return;
            }
            var adjuster = new CharacterGroupsAdjuster(m_project);

            if (adjuster.GroupsAreNotInSynchWithData)
            {
                string dlgMessage = String.Format(LocalizationManager.GetString("DialogBoxes.GroupsAreNotInSynchWithData.Message",
                                                                                "There have been changes to this project. The character groups no longer match the characters. {0} must update the groups in one of two ways:" +
                                                                                Environment.NewLine + Environment.NewLine +
                                                                                "{0} can start fresh, optimizing the number and composition of character groups based on the characters in the script and the voice actors in this project. " +
                                                                                "This is usually the recommended option." +
                                                                                "However, if the previously generated groups were manually changed most of these changes will probably be lost." +
                                                                                Environment.NewLine + Environment.NewLine +
                                                                                "Alternatively, {0} can just make the minimal changes to remove unused characters and put any new characters in a single group. This will probably require " +
                                                                                "substantial manual customization to avoid problems. If this proves too difficult, the groups can be re-optimized later by clicking {1} in the {2} dialog box." +
                                                                                Environment.NewLine + Environment.NewLine +
                                                                                "Would you like {0} to do the recommended action and create new character groups now?"),
                                                  ProductName,
                                                  LocalizationManager.GetString("DialogBoxes.VoiceActorAssignmentDlg.ToolStrip.UpdateCharacterGroups",
                                                                                "Update Character Groups...").TrimEnd('.'),
                                                  LocalizationManager.GetString("DialogBoxes.VoiceActorAssignmentDlg.WindowTitle", "Voice Actor Assignment"));

                if (MessageBox.Show(dlgMessage, ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    using (var progressDialog = new GenerateGroupsProgressDialog(m_project, (s, e) => adjuster.FullyRegenerateGroups(), false))
                        progressDialog.ShowDialog();
                }
                else
                {
                    adjuster.MakeMinimalAdjustments();
                }
            }
        }