Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected Task <bool> OnSaveAsync(BindItem item)
 {
     // 增加数据演示代码
     if (item.Id == 0)
     {
         lock (_objectLock)
         {
             item.Id = EditItems.Max(i => i.Id) + 1;
             EditItems.Add(item);
         }
     }
     else
     {
         var oldItem = EditItems.FirstOrDefault(i => i.Id == item.Id);
         if (oldItem != null)
         {
             oldItem.Name      = item.Name;
             oldItem.Address   = item.Address;
             oldItem.DateTime  = item.DateTime;
             oldItem.Count     = item.Count;
             oldItem.Complete  = item.Complete;
             oldItem.Education = item.Education;
         }
     }
     return(Task.FromResult(true));
 }
 private async Task ShowColumnsDialog()
 {
     var model  = new BindItem();
     var option = new SearchDialogOption <BindItem>()
     {
         Title = "搜索弹出框",
         Model = model,
         Items = model.GenerateColumns(p => p.GetFieldName() == nameof(BindItem.Name) || p.GetFieldName() == nameof(BindItem.Address))
     };
     await DialogService.ShowSearchDialog(option);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        protected Task OnRowButtonClick(BindItem item)
        {
            var cate    = ToastCategory.Success;
            var title   = "行内按钮处理方法";
            var content = "通过不同的函数区分按钮处理逻辑,参数 Item 为当前行数据";

            ToastService?.Show(new ToastOption()
            {
                Category = cate,
                Title    = title,
                Content  = content
            });
            return(Task.CompletedTask);
        }
Пример #4
0
 private Task <bool> OnSaveAsync(BindItem item)
 {
     // 增加数据演示代码
     if (Items != null)
     {
         if (item.Id == 0)
         {
             lock (_objectLock)
             {
                 item.Id = Items.Max(i => i.Id) + 1;
                 Items.Add(item);
             }
         }
         else
         {
             var oldItem = Items.FirstOrDefault(i => i.Id == item.Id);
             oldItem.Name    = item.Name;
             oldItem.Address = item.Address;
         }
     }
     return(Task.FromResult(true));
 }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected Task OnResetSearchAsync(BindItem item)
 {
     item.Name    = "";
     item.Address = "";
     return(Task.CompletedTask);
 }