示例#1
0
        public void EnableSync()
        {
            //Start with current cells as base

            Application.SheetChange += Application_SheetChange;

            MySavedCells = new HashSet <CellUpdate>(CellReader.GetAllCells().Where(c => c.val != ""));

            pollTimer.Enabled  = true;
            pollTimer.Elapsed += pollTimer_Elapsed;
            pollTimer.Start();
        }
示例#2
0
        private HashSet <CellUpdate> GetChangedCells()
        {
            HashSet <CellUpdate> AllMyCells = CellReader.GetAllCells();
            HashSet <CellUpdate> myChanges  = new HashSet <CellUpdate>(AllMyCells.Except(MySavedCells));

            // Get all cells no longer being used that previously had a value
            IEnumerable <CellUpdate> deletedCellsTemp = MySavedCells.Except(AllMyCells);

            for (int i = 0; i < deletedCellsTemp.Count(); i++)
            {
                /* CELL BEFORE */
                CellUpdate oldCell  = deletedCellsTemp.ElementAt(i);
                CellUpdate currCell = FindWithoutValue(AllMyCells, oldCell);

                if (currCell == null)
                {
                    CellUpdate newUC = new CellUpdate(oldCell.Row, oldCell.Col, oldCell.Worksheet, "", oldCell.TypeEnum, oldCell.changeAuthor, DateTime.Now);
                    myChanges.Add(newUC);
                }
            }

            return(myChanges);
        }