예제 #1
0
        private void addTODO(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("add TODO button");
            if (cTODOTitle.Text != "" &&
                cTODODescription.Text != "" &&
                cTODOPriority.Text != "" &&
                cTODOEndDatePicker.SelectedDate.Value.Date != null)
            {
                int priority = 0;
                switch (cTODOPriority.Text)
                {
                case "Normal":
                    priority = 0;
                    break;

                case "Soon":
                    priority = 1;
                    break;

                case "Urgent":
                    priority = 2;
                    break;

                default:
                    priority = 0;
                    break;
                }
                Console.WriteLine(priority + cTODOPriority.Text);
                DateTime        EndingAt = cTODOEndDatePicker.SelectedDate.Value.Date;
                Management.TODO todo     = new Management.TODO(cTODOTitle.Text,       // TODO Title
                                                               cTODODescription.Text, // TODO Description
                                                               user.getID(),          // User id
                                                               priority,              // Priority
                                                               DateTime.Now.Date,     // UpdatedAt
                                                               DateTime.Now.Date,     // CreatedAt
                                                               DateTime.Now.Date,     // StartingAt
                                                               EndingAt               // EndingAt
                                                               );
                TODOQuery.addTODO(todo);
                todoList.Items.Add(new Component.TodoListItem(todo, this));
            }
        }
예제 #2
0
        public TodoListItem(Management.TODO todo, TodoPage page)
        {
            this.todo     = todo;
            this.todoPage = page;

            BrushConverter bc = new BrushConverter();

            blue = (Brush)bc.ConvertFrom("#FF2196F3");
            blue.Freeze();

            // ListItem property
            Background = Brushes.White;
            Effect     = new DropShadowEffect
            {
                Opacity = 0.1
            };

            // Button
            Button button = new Button
            {
                Padding     = new Thickness(9),
                Background  = blue,
                BorderBrush = blue,
                Foreground  = Brushes.White
            };

            // Button checkmark icon.
            PackIcon checkIcon = new PackIcon();

            checkIcon.Kind = PackIconKind.Check;
            button.Content = checkIcon;

            // Button click event
            button.Click += clickCheckmark;

            // Textblock
            TextBlock todoTitleBox = new TextBlock
            {
                Text              = todo.GetTitle(),
                Margin            = new Thickness(30, 0, 0, 0),
                VerticalAlignment = VerticalAlignment.Center
            };

            // Grid
            ColumnDefinition c1 = new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Star)
            };
            ColumnDefinition c2 = new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Star)
            };
            Grid gridContainer = new Grid();

            gridContainer.ColumnDefinitions.Add(c1);
            gridContainer.ColumnDefinitions.Add(c2);
            gridContainer.Children.Add(todoTitleBox);
            gridContainer.Children.Add(button);
            Grid.SetColumn(button, 0);
            Grid.SetColumn(todoTitleBox, 1);

            AddChild(gridContainer);
        }