public void EditFavoriteTask(FavoriteWorkTask favoriteWorkTask)
        {
            var editDialogVm = new TaskConfigEditDialogViewModel("ボタンタイトル", favoriteWorkTask.ButtonTitle, favoriteWorkTask.ConvertToDomainModel());

            editDialogVm.ShowQuickStartButton.Value = false;
            editDialogVm.ShowDeleteButton.Value     = true;

            var result = TransitionHelper.Current.TransitionModal <TaskConfigEditDialog>(editDialogVm);

            if (result == ModalTransitionResponse.Yes)
            {
                if (editDialogVm.NeedDelete)
                {
                    FavoriteWorkTasks.Remove(favoriteWorkTask);
                    RegistFavoriteWorkTasksConfig();
                }
                else
                {
                    var inputValue = editDialogVm.TaskCardViewModel.DomainModel;

                    // 変更通知機能がないのでdelete-insert方式で無理やりViewに変更通知する
                    var targetIndex = FavoriteWorkTasks.IndexOf(favoriteWorkTask);
                    FavoriteWorkTasks.RemoveAt(targetIndex);

                    var favTask = FavoriteWorkTask.FromDomainObject(inputValue);
                    favTask.ButtonTitle = editDialogVm.ConfigTitle.Value;
                    FavoriteWorkTasks.Insert(targetIndex, favTask);

                    RegistFavoriteWorkTasksConfig();
                }
            }
        }
        public void AddFavoriteTask()
        {
            var editDialogVm = new TaskConfigEditDialogViewModel("ボタンタイトル", "");

            editDialogVm.ShowQuickStartButton.Value = false;

            var result = TransitionHelper.Current.TransitionModal <TaskConfigEditDialog>(editDialogVm);

            if (result == ModalTransitionResponse.Yes)
            {
                var inputValue = editDialogVm.TaskCardViewModel.DomainModel;
                var favTask    = FavoriteWorkTask.FromDomainObject(inputValue);
                favTask.ButtonTitle = editDialogVm.ConfigTitle.Value;
                FavoriteWorkTasks.Add(favTask);

                RegistFavoriteWorkTasksConfig();
            }
        }
Ejemplo n.º 3
0
 public ShortcutAddingTaskCommand(FavoriteWorkTask workTask)
 {
     _WorkTask = workTask;
 }