public async void UpdateTodoName(Todo todo) { InputTextDialog inputTextDialog = new InputTextDialog("修改检查项","检查项名称",todo.Name); inputTextDialog.PrimaryButtonClick += (async (ContentDialog sender, ContentDialogButtonClickEventArgs e) => { InputTextViewModel vm = (InputTextViewModel)sender.DataContext; this.StartProgress(); Todo returnTodo = await Helper.WorktileClient.UpdateTaskTodo(Task.Pid, Task.Tid, todo.TodoId, vm.InputValue); this.EndProgress(); if (returnTodo != null) { todo.Name = returnTodo.Name; } else { ShowAlert("更新检查项内容失败,请稍后重试!"); } }); await inputTextDialog.ShowAsync(); }
private async void AddTodo() { InputTextDialog inputDialog = new InputTextDialog("新增检查项","检查项名称"); inputDialog.PrimaryButtonClick += (async (ContentDialog sender, ContentDialogButtonClickEventArgs e) => { InputTextViewModel vm = (InputTextViewModel)sender.DataContext; string commentName = vm.InputValue; if (string.IsNullOrEmpty(commentName)) return; this.StartProgress(); Todo todo = await Helper.WorktileClient.AddTaskTodo(Task.Pid, Task.Tid, commentName); this.EndProgress(); if (todo != null) { Task.Todos.Add(todo); } else { ShowAlert("提交失败,请稍后重试!"); } }); await inputDialog.ShowAsync(); }
private async void CreateEntry() { InputTextDialog inputDialog = new InputTextDialog("创建任务列表", "任务列表名称"); inputDialog.PrimaryButtonClick += (async (ContentDialog sender, ContentDialogButtonClickEventArgs e) => { InputTextViewModel vm = (InputTextViewModel)sender.DataContext; string entryName = vm.InputValue; if (string.IsNullOrEmpty(entryName)) return; this.StartProgress(); Entry entry = await Helper.WorktileClient.CreateEntry(Project.Pid, entryName); if (entry != null) { Project.EntryList.Add(entry); SelectedEntry = entry; } else { ShowAlert("创建任务列表失败,请稍后重试!"); } this.EndProgress(); }); await inputDialog.ShowAsync(); }
private async void ReNameEntry() { InputTextDialog inputDialog = new InputTextDialog("重命名任务列表", "任务列表名称", SelectedEntry.Name); inputDialog.PrimaryButtonClick += (async (ContentDialog sender, ContentDialogButtonClickEventArgs e) => { InputTextViewModel vm = (InputTextViewModel)sender.DataContext; string entryName = vm.InputValue; if (string.IsNullOrEmpty(entryName)) return; this.StartProgress(); bool success = await Helper.WorktileClient.ReNameEntry(Project.Pid, SelectedEntry.EntryId, entryName); if (success) { SelectedEntry.Name = entryName; } else { ShowAlert("重命名任务列表失败,请稍后重试!"); } this.EndProgress(); }); await inputDialog.ShowAsync(); }
private async void AddComment() { InputTextDialog inputDialog = new InputTextDialog(); inputDialog.Title = "请输入评论内容"; inputDialog.PrimaryButtonClick += (async (ContentDialog sender, ContentDialogButtonClickEventArgs e) => { InputTextDialogViewModel vm = (InputTextDialogViewModel)sender.DataContext; string commentName = vm.InputValue; if (string.IsNullOrEmpty(commentName)) return; ProgressBarVisibility = Visibility.Visible; Comment comment = await Helper.WorktileClient.AddTaskComment(Task.Pid, Task.Tid, commentName); if (comment != null) { CommentList.Add(comment); } else { await new MessageDialog("提交失败,请稍后重试!").ShowAsync(); } ProgressBarVisibility = Visibility.Collapsed; }); await inputDialog.ShowAsync(); }