private async Task showChildAsync() { var dispatcherQueue = Windows.System.DispatcherQueue.GetForCurrentThread(); var dialog = new TaskDialog(); var result = await dialog.ShowAsync(); if (result != ContentDialogResult.Primary) { return; } if (!dialog.CheckForm()) { return; } var item = dialog.FormData(); item.ParentId = id; var data = await App.Repository.Task.SaveTaskAsync(item); if (data == null) { return; } await dispatcherQueue.EnqueueAsync(() => { Toast.Tip("添加成功"); }); }
private async Task FastCreateAsync() { var dispatcherQueue = Windows.System.DispatcherQueue.GetForCurrentThread(); var dialog = new TaskDialog(); dialog.Title = "快捷创建任务"; var result = await dialog.ShowAsync(); if (result != ContentDialogResult.Primary) { return; } if (!dialog.CheckForm()) { return; } var data = await App.Repository.Task.FastCreateAsync(dialog.FormData()); if (data == null) { return; } await dispatcherQueue.EnqueueAsync(() => { Toast.Tip("添加成功"); ViewModel.Items.Add(data); }); }