Exemple #1
0
        public Row InsertRow(Row parent, int position, IDictionary <Column, object> initialData = null)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            if (position < 0 || position > parent.Children.Count)
            {
                throw new ArgumentOutOfRangeException();
            }

            var row = new Row
            {
                ParentRow = parent
            };

            parent._children.Insert(0, row);

            //todo unit test data assignment here
            foreach (var col in Columns)
            {
                if (initialData != null && initialData.TryGetValue(col, out var initialValue))
                {
                    row.RowValues[col] = initialValue;
                }
                else
                {
                    row.RowValues[col] = col.DefaultValue;
                }
            }

            RowAdded?.Invoke(this, new RowAddedEventArgs(row, position));
            return(row);
        }
Exemple #2
0
 ///<summary>Raises the RowAdded event.</summary>
 ///<param name="e">A RowEventArgs object that provides the event data.</param>
 protected virtual void OnRowAdded(RowListEventArgs e)
 {
     EventSequence.Execute(() => RowAdded?.Invoke(this, e));
 }
Exemple #3
0
 protected virtual void OnRowAdded(EventArgs e)
 {
     RowAdded?.Invoke(this, e);
 }
Exemple #4
0
 protected override void OnRowAdded(RowListEventArgs e)
 {
     base.OnRowAdded(e);
     EventSequence.Execute(() => RowAdded?.Invoke(this, new RowListEventArgs <TRow>((TRow)e.Row, e.Index)));
 }
Exemple #5
0
 /// <summary>
 /// Raise the RowAdded event
 /// </summary>
 /// <param name="newRow"></param>
 protected virtual void OnRowAdded(int newRow)
 {
     RowAdded?.Invoke(this, newRow);
 }
Exemple #6
0
 public void OnRowAdded(T t)
 {
     State = TableState.Changed;
     RowAdded?.Invoke(this, new RowEventArgs <T>(t));
 }