Пример #1
0
        private void OnAddActor(object sender, EventArgs e)
        {
            DialogRename dialog = new DialogRename(project.GenerateNewActorID());
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                Actor actor = new Actor();
                actor.ID   = dialog.NewID;
                actor.Name = dialog.NewID;

                project.ListActors.Add(actor);

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

                if (currentActor == null)   //SelectedIndex will be already set on first insertion, this is a fallback for this special case
                {
                    currentActor = listBoxActors.SelectedValue as Actor;
                    RefreshActorView();
                }

                SetDirty();
            }
        }
Пример #2
0
        private void OnEditIDClicked(object sender, EventArgs e)
        {
            if (!ready)
            {
                return;
            }

            DialogRename dialog = new DialogRename(currentActor.ID);

            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string oldID = currentActor.ID;
                if (project.ChangeActorID(currentActor, dialog.NewID))
                {
                    List <Dialogue> dialogues = ResourcesHandler.GetAllDialogues();
                    foreach (Dialogue dialogue in dialogues)
                    {
                        if (dialogue.UpdateActorID(oldID, currentActor.ID))
                        {
                            ResourcesHandler.SetDirty(dialogue);
                        }
                    }

                    textBoxID.Text = currentActor.ID;

                    SetDirty();

                    if (EditorCore.MainWindow != null)
                    {
                        EditorCore.MainWindow.RefreshDirtyFlags();
                    }
                }
            }
        }