Пример #1
0
        private async void AddNewPlanTarget(object sender, RoutedEventArgs e)
        {
            if (!HasNotEmptySetting())
            {
                ShowMessage("请填写用户信息", false);
                return;
            }
            newPlanTargetName.Text = newPlanTargetName.Text.Trim();
            if (newPlanTargetName.Text == "")
            {
                return;
            }
            try
            {
                AppTask task = await HttpApi.CreateTask(newPlanTargetName.Text, AppTask.TypeToString(TaskType.Todo), date : newPlanTargetDeadline.SelectedDate?.AddDays(1).Date.ToString());

                SimpleTaskCard card = task.ToSimpleTaskCard(false);
                card.CardRemove   += TargetRemoved;
                card.StatusChange += TargetStatusChange;
                planTargetsList.Children.Add(card);
                planTargetsListScroll.ScrollToBottom();
                newPlanTargetName.Text = "";
            }
            catch (Exception exception)
            {
                ShowMessage(exception.Message, false);
            }
        }
Пример #2
0
        public List <AppTask> PlanTargetTaskFilter(List <AppTask> tasks, Tag todayTargetTag)
        {
            List <AppTask> planTargetTasks = new List <AppTask>();

            foreach (AppTask task in tasks)
            {
                if (!task.Tags.Contains(todayTargetTag.Id) && task.Type == AppTask.TypeToString(TaskType.Todo))
                {
                    planTargetTasks.Add(task);
                }
            }

            return(planTargetTasks);
        }
Пример #3
0
        public List <AppTask> DailyTargetTaskFilter(List <AppTask> tasks)
        {
            List <AppTask> dailyTargetTasks = new List <AppTask>();

            foreach (AppTask task in tasks)
            {
                if (task.Type == AppTask.TypeToString(TaskType.Daily))
                {
                    dailyTargetTasks.Add(task);
                }
            }

            return(dailyTargetTasks);
        }