Ejemplo n.º 1
0
        /// <summary>
        /// Inserts an actor in the grid
        /// </summary>
        /// <param name="grid">The grid where the actor will be inserted</param>
        /// <param name="editButton">The edit button that will be enabled (if there is an actor)</param>
        /// <param name="removeButton">Ditto for the removeButton</param>
        /// <param name="type">The type of the new blueprint</param>
        /// <param name="list">The list that the new actor will be added to</param>
        /// <param name="dataName">The name of the data cell in the grid</param>
        private static void insertActor(DataGridView grid,
    EnumTypes.actorType type, ref LinkedList<Actor> list, String dataCell)
            {
            modifyForm = ModifyNew.getModifyNew(type);

            // If the user wants to create a new blueprint, and there is only one type, then we might as well create that
            modifyForm.testCreate();

            Actor actor = null;
            if (modifyForm.ShowDialog() == DialogResult.OK)
                {
                actor = ModifyNew.lastActor;
                if (actor != null)
                    {
                    LinkedList<Actor> dummyList = new LinkedList<Actor>();
                    dummyList.AddLast(actor);
                    setGrid(grid, dummyList, list, dataCell, type);
                    }
                }
            }
Ejemplo n.º 2
0
 /// <summary>
 /// Edit a actor in a multiple actor grid
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="type">The type of actor</param>
 /// <param name="dataName">The name of the datacell</param>
 /// <param name="list">The list of actors (extra, item, triggers)</param>
 private static void editActor(DataGridView grid, EnumTypes.actorType type, String dataName, LinkedList<Actor> list)
     {
     if (grid.SelectedRows.Count > 0)
         {
         int gridNumber = grid.SelectedRows[0].Index;
         Actor oldActor = gridGetActor(grid, dataName);
         if (oldActor != null)
             {
             modifyForm = ModifyNew.getModifyNew(oldActor, type);
             if (modifyForm.ShowDialog() == DialogResult.OK)
                 {
                 Actor actor = ModifyNew.lastActor;
                 grid[0, gridNumber].Value = actor.ToString();
                 grid[1, gridNumber].Value = actor.Tag;
                 grid[dataName, gridNumber].Value = actor;
                 if (list != null)
                     {
                     list.Remove(oldActor);
                     list.AddLast(actor);
                     }
                 }
             }
         }
     }