コード例 #1
0
        public ICmd Exec()
        {
            var inverse = new RestoreBackgroundColor(cell, cell.getBGColor()); //create inverse object

            cell.setBGColor(BGColor);                                          //restore the cell's previous background color
            return(inverse);                                                   //return inverse object to add to the undo or redo stack
        }
コード例 #2
0
        public void pushToUndoBGColorGroup(List <Cell> list) //push group of color changes to undo stack
        {
            List <ICmd> cmds = new List <ICmd>();

            for (int i = 0; i < list.Count; i++) //loop through list of cells to create list of restore background color objects
            {
                RestoreBackgroundColor temp = new RestoreBackgroundColor(list[i], list[i].getBGColor());
                cmds.Add(temp);
            }
            MultiCmd mcmd = new MultiCmd(cmds); //create new multi command object

            mcmd.setMessage(" change in background color of cells");
            undo.Push(mcmd); //add multi command object to list
        }