/// <summary> /// 編集処理を実行します。 /// </summary> /// <param name="taskItem">タスク</param> /// <returns>Task</returns> private async Task <bool> ExecuteEdit(TaskItem taskItem) { var win = new TaskEditForm(); win.Initialize(this.ShowingGroup, taskItem); var ret = await win.ShowWindow(ResourceManager.Instance.MainForm); if (ret == SubWindowResult.Submit) { ResourceManager.Instance.AddTaskItem(taskItem.Group, taskItem); if (this.ShowingGroup != null) { this.RefleshTaskItems(this.ShowingGroup.ChildTaskItems.ToList(), this.ShowingGroup); } else { if (!this.isVisibleAddTask) { var taskList = ResourceManager.Instance.GetAllTaskItems(); var filtered = Utils.FilterRecentLimitTask(taskList); this.RefleshTaskItems(filtered, null); } else { var list = ResourceManager.Instance.GetAllTaskItems(); this.RefleshTaskItems(list, null); } } return(true); } return(false); }
/// <summary> /// 追加処理を実行します。 /// </summary> /// <returns>Task</returns> private async Task <bool> ExecuteAdd() { var item = new TaskItem(); KeyInfo groupKey = null; if (this.ShowingGroup != null) { groupKey = this.ShowingGroup.Key; } item.Key = KeyInfo.CreateKeyInfoTask(groupKey); var win = new TaskEditForm(); win.Initialize(this.ShowingGroup, item); var ret = await win.ShowWindow(ResourceManager.Instance.MainForm); if (ret == SubWindowResult.Submit) { if (item.Group != null) { if (item.Group.Equals(groupKey) || this.ShowingGroup == null) { ResourceManager.Instance.AddTaskItem(item.Group, item); this.AddRow(item); } } return(true); } return(false); }