Пример #1
0
        protected void OnSaveComplete(DnDItem <TListItem, TItem, TGroup> itemComponent)
        {
            if (!int.TryParse(itemComponent.Address.Split('.').Last(), out var itemIndex))
            {
                Console.Error.WriteLine("Could not determine the index for the new item.  Setting it to the end of the list.");
                itemIndex = List.Count() - 1;
            }
            DnDState.NewItem = Activator.CreateInstance <TItem>();

            if (itemComponent.IsAdd)
            {
                DnDState.NewItem = Activator.CreateInstance <TItem>();
                DnDState.ShowNewItemDict.Clear();
            }
        }
Пример #2
0
 protected void OnCancelComplete(DnDItem <TListItem, TItem, TGroup> itemComponent)
 {
     if (!int.TryParse(itemComponent.Address.Split('.').Last(), out var itemIndex))
     {
         Console.Error.WriteLine("Could not determine the index of the new item being cancelled.");
         return;
     }
     if (itemComponent.IsAdd)
     {
         DnDState.ShowNewItemDict.Clear();
     }
     else
     {
         // TODO: Determine if anything needs to be done
     }
 }