예제 #1
0
 /// <summary>
 /// Adding element. Element must comply with the rules, which creator of specific manager created.
 /// </summary>
 /// <typeparam name="T1"></typeparam>
 /// <param name="value"></param>
 /// <returns></returns>
 public TLimit Add(TLimit val)
 {
     if (CanAddNull == false && val is null)
     {
         throw new ArgumentNullException(nameof(val));
     }
     if (CanAdd(val))
     {
         List.Add(val);
         OnAddElement.Invoke(this, new CollectionActionArgs <TLimit>(CManagerAction.Add, val, this));
         return(val);
     }
     return(null);
 }
 private void btnAddChild_Click_1(object sender, EventArgs e)
 {
     OnAddElement?.Invoke(this, new AddEventArgs {
         Parent = SelectedObject
     });
 }
 /// <summary>
 /// Add element to root
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAdd_Click(object sender, EventArgs e)
 {
     OnAddElement?.Invoke(this, new AddEventArgs {
         Parent = null
     });
 }