Ejemplo n.º 1
0
        public ContactSelect(TaskWindow taskWindow, int userId)
        {
            InitializeComponent();
            _service    = new ApplicationService();
            _userId     = userId;
            _taskWindow = taskWindow;

            List <Contact> Contact = _service.GetContactsByUserId(userId);

            foreach (Contact contact in Contact)
            {
                this.contactSelectView.Items.Add(contact);
            }
        }
Ejemplo n.º 2
0
        public CreateToDoList(int userId, int toDoListId)
        {
            this._userId = userId;
            InitializeComponent();
            _service = new ApplicationService();

            if (toDoListId != 0)
            {
                ToDoList toDoList = _service.GetToDoById(toDoListId);

                Title.Text   = toDoList.Title;
                _toDoListId  = toDoList.Id;
                this._userId = toDoList.UserId;

                CreateUpdateTitleToDo.Content = "Liste bearbeiten";
            }
            else
            {
                CreateUpdateTitleToDo.Content = "Neue Liste hinzufügen";
            }
        }
Ejemplo n.º 3
0
 public MainWindow()
 {
     InitializeComponent();
     DatabaseConnection.Seed();
     _service = new ApplicationService();
 }
Ejemplo n.º 4
0
        public ToDoListWindow(int userId)
        {
            InitializeComponent();
            _userId  = userId;
            _service = new ApplicationService();
            List <ToDoList> toDoLists = _service.GetToDoListsByUserId(userId);

            ToDoListList.Items.Clear();

            foreach (var toDoListItem in toDoLists)
            {
                //Zusammenbau eines Items
                StackPanel toDoNonCheck = new StackPanel()
                {
                    Orientation = Orientation.Horizontal
                };
                ImageAwesome image = new ImageAwesome()
                {
                    Icon = FontAwesomeIcon.Close, Width = _iconWidth, Height = _iconHeight, HorizontalAlignment = HorizontalAlignment.Center
                };
                TextBlock textBox = new TextBlock()
                {
                    Text = toDoListItem.Title + " "
                };
                toDoNonCheck.Children.Add(textBox);
                toDoNonCheck.Children.Add(image);

                StackPanel toDoCheck = new StackPanel()
                {
                    Orientation = Orientation.Horizontal
                };
                image = new ImageAwesome()
                {
                    Icon = FontAwesomeIcon.Check, Width = _iconWidth, Height = _iconHeight, HorizontalAlignment = HorizontalAlignment.Center
                };
                textBox = new TextBlock()
                {
                    Text = toDoListItem.Title + " "
                };
                toDoCheck.Children.Add(textBox);
                toDoCheck.Children.Add(image);


                TreeViewItem toDoListTitle = new TreeViewItem();
                toDoListTitle.Header = toDoNonCheck;
                toDoListTitle.Name   = "toDoList" + toDoListItem.Id.ToString();
                ToDoListList.Items.Add(toDoListTitle);
                List <Task> tasks         = _service.GetTaksByToDoListId(toDoListItem.Id);
                int         finishedCount = 0;

                foreach (var task in tasks)
                {
                    StackPanel taskNonCheck = new StackPanel()
                    {
                        Orientation = Orientation.Horizontal
                    };
                    image = new ImageAwesome()
                    {
                        Icon = FontAwesomeIcon.Close, Width = _iconWidth, Height = _iconHeight, HorizontalAlignment = HorizontalAlignment.Center
                    };
                    textBox = new TextBlock()
                    {
                        Text = task.Title + " "
                    };
                    taskNonCheck.Children.Add(textBox);
                    taskNonCheck.Children.Add(image);

                    StackPanel taskCheck = new StackPanel()
                    {
                        Orientation = Orientation.Horizontal
                    };
                    image = new ImageAwesome()
                    {
                        Icon = FontAwesomeIcon.Check, Width = _iconWidth, Height = _iconHeight, HorizontalAlignment = HorizontalAlignment.Center
                    };
                    textBox = new TextBlock()
                    {
                        Text = task.Title + " "
                    };
                    taskCheck.Children.Add(textBox);
                    taskCheck.Children.Add(image);


                    TreeViewItem taskTitle = new TreeViewItem();
                    taskTitle.Header = taskNonCheck;

                    if (_service.GetBoolFromTask(task.Id))
                    {
                        taskTitle.Header = taskCheck;
                        finishedCount++;
                    }

                    taskTitle.Name = "task" + task.Id.ToString();
                    toDoListTitle.Items.Add(taskTitle);
                }
                if (finishedCount == tasks.Count && finishedCount != 0)
                {
                    toDoListTitle.Header = toDoCheck;
                }
            }
        }