public bool OnRowEditEvent(RowEditEventArgs e) { var shape = CurrentSearchAndModifyAttributeshapes[e.RowNumber]; return(FeatureEditCallback(new FeatureSourceRowEditEventArgs(e, shape))); }
///<summary> /// Edit the specified rows via a client supplied callback ///</summary> ///<param name="indices">rows to edit</param> ///<param name="rowCallback">client supplied callback</param> public virtual void Edit(IEnumerable<int> indices, RowEditEvent rowCallback) { var fi = new FileInfo(_fileName); if ((int)fi.Length == _headerLength) { // The file is empty, so just return return; } foreach (Field field in _columns) { field.NumberConverter = new NumberConverter(field.Length, field.DecimalCount); } var fields = new Fields(_columns); using (var myStream = new FileStream(_fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, _recordLength)) { var e = new RowEditEventArgs(_recordLength - 1, fields); foreach (int rowIndex in indices) { int strt = GetFileIndex(rowIndex); long offset = _headerLength + 1 + strt * _recordLength; myStream.Seek(offset, SeekOrigin.Begin); myStream.Read(e.ByteContent, 0, _recordLength - 1); e.RowNumber = rowIndex; e.Modified = false; if (rowCallback(e)) return; if (e.Modified) { myStream.Seek(offset, SeekOrigin.Begin); myStream.Write(e.ByteContent, 0, _recordLength - 1); } } } }
public bool OnRowEditEvent(RowEditEventArgs e) { var shape = CurrentSearchAndModifyAttributeshapes[e.RowNumber]; return FeatureEditCallback(new FeatureSourceRowEditEventArgs(e, shape)); }