/*************************************************************
        * Function: chooseBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
        * Date Created: March 8, 2017
        * Date Last Modified: March 8, 2017
        * Description: button for change bgcolor
        * Return: void
        *************************************************************/
        private void chooseBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int selectedColor = 0;

            List <IUndoRedoCmd> undos = new List <IUndoRedoCmd>();

            ColorDialog colorDialog = new ColorDialog();

            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                selectedColor = colorDialog.Color.ToArgb();

                foreach (DataGridViewCell cell in dataGridView1.SelectedCells)
                {
                    Cell spreadsheetCell = ssheet.GetCell(cell.RowIndex, cell.ColumnIndex);

                    RestoreBGColor tempBGClass = new RestoreBGColor((int)spreadsheetCell.BGColor, spreadsheetCell.Name);

                    undos.Add(tempBGClass);

                    spreadsheetCell.BGColor = (uint)selectedColor;
                }

                multiCmds tempCmd = new multiCmds(undos, "changing cell background color");

                UnRedo.AddUndos(tempCmd);

                refreshUndoRedoButtons();
            }
        }
        /*************************************************************
        * Function: dataGridView1_CellEndEdit(object sender, DataGridViewCellCancelEventArgs e)
        * Date Created: Feb 8, 2017
        * Date Last Modified: Feb 9, 2017
        * Description: dataGridView1_CellEndEdit
        * Return: void
        *************************************************************/
        void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            int row = e.RowIndex, column = e.ColumnIndex; string m_Text;

            IUndoRedoCmd[] undos = new IUndoRedoCmd[1];

            Cell tempCell        = ssheet.GetCell(row, column);

            undos[0] = new RestoreText(tempCell.Text, tempCell.Name);

            try
            {
                m_Text = dataGridView1.Rows[row].Cells[column].Value.ToString();
            }
            catch (NullReferenceException)
            {
                m_Text = "";
            }

            tempCell.Text = m_Text;
            //get a temp cmd for undo;
            multiCmds tmpcmd = new multiCmds(undos, "cell text change");

            //push in undo stack
            UnRedo.AddUndos(tmpcmd);

            dataGridView1.Rows[row].Cells[column].Value = tempCell.Value;

            refreshUndoRedoButtons();
        }