Exemple #1
0
        private void OnRemoveVoiceActor(object sender, EventArgs e)
        {
            int index = listBoxVoiceActors.SelectedIndex;

            if (project.ListVoiceActors.Count == 0)
            {
                return;
            }

            currentVoiceActor = null;
            project.ListVoiceActors.RemoveAt(index);
            (listBoxVoiceActors.DataSource as BindingSource).ResetBindings(false);

            if (project.ListVoiceActors.Count > 0)
            {
                listBoxVoiceActors.SelectedIndex = 0;

                if (currentVoiceActor == null)
                {
                    currentVoiceActor = listBoxVoiceActors.SelectedItem as VoiceActor;
                    RefreshVoiceActorView();
                }
            }

            RefreshVoiceKitVoiceActorList();

            SetDirty();
        }
Exemple #2
0
        private void OnVoiceActorIndexChanged(object sender, EventArgs e)
        {
            var listBox = sender as ListBox;

            currentVoiceActor = listBox.SelectedValue as VoiceActor;
            RefreshVoiceActorView();
        }
Exemple #3
0
 public string GetLocalizedVoiceActorFromKit(VoiceKit kit, Language language)
 {
     if (kit != null)
     {
         VoiceActor actor = GetVoiceActor(kit.VoiceActor);
         if (actor != null)
         {
             return(actor.GetLocalizedActor(language));
         }
     }
     return("");
 }
Exemple #4
0
 public string GetVoiceActorNameFromKit(VoiceKit kit)
 {
     if (kit != null)
     {
         VoiceActor actor = GetVoiceActor(kit.VoiceActor);
         if (actor != null)
         {
             return(actor.Name);
         }
     }
     return("");
 }
Exemple #5
0
        public DialogVoiceActors(DocumentProject inDocument, VoiceActor inActor)
        {
            InitializeComponent();

            document = inDocument;
            actor    = inActor;

            listBoxLanguages.DataSource    = new BindingSource(ResourcesHandler.Project.ListLanguages, null);
            listBoxLanguages.DisplayMember = "Name";

            ready = true;
        }
Exemple #6
0
        public bool ChangeVoiceActorName(VoiceActor voiceActor, string newName)
        {
            if (newName == String.Empty)   //Forbid empty string
            {
                return(false);
            }

            if (ListVoiceActors.Any(item => item.Name == newName))   //Forbid two voice actors with same name
            {
                return(false);
            }

            ListVoiceKits.FindAll(item => item.VoiceActor == voiceActor.Name).ForEach(item => item.VoiceActor = newName);

            voiceActor.Name = newName;
            return(true);
        }
Exemple #7
0
        private void OnAddVoiceActor(object sender, EventArgs e)
        {
            VoiceActor voiceActor = new VoiceActor()
            {
                Name = "Undefined"
            };

            project.ListVoiceActors.Add(voiceActor);

            (listBoxVoiceActors.DataSource as BindingSource).ResetBindings(false);
            listBoxVoiceActors.SelectedIndex = listBoxVoiceActors.Items.Count - 1;

            if (currentVoiceActor == null)   //SelectedIndex will be already set on first insertion, this is a fallback for this special case
            {
                currentVoiceActor = listBoxVoiceActors.SelectedItem as VoiceActor;
                RefreshVoiceActorView();
            }

            RefreshVoiceKitVoiceActorList();

            SetDirty();
        }