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(); }
private void OnVoiceActorIndexChanged(object sender, EventArgs e) { var listBox = sender as ListBox; currentVoiceActor = listBox.SelectedValue as VoiceActor; RefreshVoiceActorView(); }
public string GetLocalizedVoiceActorFromKit(VoiceKit kit, Language language) { if (kit != null) { VoiceActor actor = GetVoiceActor(kit.VoiceActor); if (actor != null) { return(actor.GetLocalizedActor(language)); } } return(""); }
public string GetVoiceActorNameFromKit(VoiceKit kit) { if (kit != null) { VoiceActor actor = GetVoiceActor(kit.VoiceActor); if (actor != null) { return(actor.Name); } } return(""); }
public DialogVoiceActors(DocumentProject inDocument, VoiceActor inActor) { InitializeComponent(); document = inDocument; actor = inActor; listBoxLanguages.DataSource = new BindingSource(ResourcesHandler.Project.ListLanguages, null); listBoxLanguages.DisplayMember = "Name"; ready = true; }
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); }
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(); }