Exemplo n.º 1
0
        /// <summary>
        /// This will be called when edit begins
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            int row = e.RowIndex;
            int col = e.ColumnIndex;

            dataGridView1.Rows[row].Cells[col].Value = (s.GetCell(row, col)).Text;
        }
Exemplo n.º 2
0
        public void TestCheckCycleMultiCycle()
        {
            Spreadsheet sheet = new Spreadsheet(3, 3);

            sheet.SetCellText(sheet.GetCell("A1"), "=B1");
            sheet.SetCellText(sheet.GetCell("B1"), "=B2");
            sheet.SetCellText(sheet.GetCell("B2"), "=A1");
            Assert.IsTrue((bool)Utility.GetMethod <Spreadsheet>("CheckCycle").Invoke(sheet, new object[] { sheet.GetCell("A1") }));
        }
Exemplo n.º 3
0
        public void TestUnsubscribeCellDependencies()
        {
            var sheet      = new Spreadsheet(2, 2);
            var subscriber = sheet.GetCell("A1");

            Cell[] subscribees = { sheet.GetCell("A2"), sheet.GetCell("B1") };
            subscriber.Dependencies.AddRange(new string[] { "A2", "B1" });
            foreach (var subscribee in subscribees)
            {
                subscribee.PropertyChanged += subscriber.Cell_PropertyChanged;
            }

            var unsubscribeInfo = Utility.GetMethod <Spreadsheet>("UnsubscribeCellDependencies");

            unsubscribeInfo.Invoke(sheet, new object[] { subscriber });
            var eventInfo = Utility.GetField <Cell>("PropertyChanged");

            Assert.AreEqual(0, subscriber.Dependencies.Count);
        }