コード例 #1
0
        /// <summary>
        /// OnInitialized 方法
        /// </summary>
        protected override void OnInitialized()
        {
            base.OnInitialized();

            TreeItems = FooTree.Generate(Localizer);
            AllItems  = new List <EditFooTree>();
            AllItems.AddRange(EditFooTree.Generate(Localizer, AllItems));
            AllItems.AddRange(EditFooTree.Generate(Localizer, AllItems, 10, 1));
            AllItems.AddRange(EditFooTree.Generate(Localizer, AllItems, 20, 2));
            AllItems.AddRange(EditFooTree.Generate(Localizer, AllItems, 30, 11));
            AllItems.AddRange(EditFooTree.Generate(Localizer, AllItems, 40, 12));
            AllItems.AddRange(EditFooTree.Generate(Localizer, AllItems, 50, 21));
            AllItems.AddRange(EditFooTree.Generate(Localizer, AllItems, 60, 22));
        }
コード例 #2
0
 private Task <bool> OnSaveAsync(EditFooTree item)
 {
     if (item.Id == 0)
     {
         item.Id = AllItems.Max(i => i.Id) + 1;
         AllItems.Add(item);
     }
     else
     {
         var oldItem = AllItems.FirstOrDefault(i => i.Id == item.Id);
         if (oldItem != null)
         {
             oldItem.ParentId = item.ParentId;
             oldItem.Name     = item.Name;
             oldItem.DateTime = item.DateTime;
             oldItem.Address  = item.Address;
             oldItem.Count    = item.Count;
         }
     }
     return(Task.FromResult(true));
 }
コード例 #3
0
 private Task <IEnumerable <EditFooTree> > OnTreeExpandQuary(EditFooTree foo)
 {
     return(Task.FromResult(AllItems.Where(f => f.ParentId == foo.Id)));
 }
コード例 #4
0
        private async Task <IEnumerable <EditFooTree> > OnTreeExpandQuary(EditFooTree foo)
        {
            await Task.Delay(50);

            return(AllItems.Where(f => f.ParentId == foo.Id));
        }