Пример #1
0
        private void Exec_Receive_Request(object state)
        {
            ViewChangeNotification <TData> notification = (ViewChangeNotification <TData>)state;

            TData oldData = (TData)notification.OldData;
            TData newData = (TData)notification.NewData;

            // check for clear notification
            if (notification.Change == CacheChange.CacheCleared)
            {
                _OriginalData.Clear();
            }

            // process other notifications
            if (oldData != null)
            {
                // delete
                string oldKey = _DataHelper.GetUniqueKey(oldData);
                if (oldKey != null)
                {
                    _OriginalData.Remove(oldKey);
                }
            }
            if (newData != null)
            {
                // create/update
                string newKey = _DataHelper.GetUniqueKey(newData);
                if (newKey != null)
                {
                    _OriginalData[newKey] = newData;
                }
            }
            // optimisation - todo - only re-collate if item has actually changed

            // update filters
            if ((_FilterGroup != null) && (newData != null))
            {
                for (int column = 0; column < _ViewHelper.ColumnCount; column++)
                {
                    _FilterGroup.AddFilterValue(column, GetDisplayValueHelper(newData, column));
                }
            }

            // rebuild view
            _CollateRequestHandler.Post(null);
        }
Пример #2
0
 public void UpdateData(ViewChangeNotification <TData> notification)
 {
     _ReceiveRequestHandler.Post(notification);
 }