Exemplo n.º 1
0
        private void backToComplete(object sender, RoutedEventArgs e)
        {
            CompleteTask comp = new CompleteTask(userObject, taskIndex);

            NavigationService.Navigate(comp);


            //NavigationService nav = NavigationService.GetNavigationService(this);
            //nav.Navigate(new Uri("/GUI/CompleteTask.xaml", UriKind.RelativeOrAbsolute));
        }
Exemplo n.º 2
0
        private void editTask(object sender, RoutedEventArgs e)
        {
            //task info
            tasks[taskIndex].setTitle(this.TitleTextBox.Text);
            tasks[taskIndex].setDescription(this.descTextBox.Text);

            bool yes = this.yesButton.IsChecked.Value;
            bool no  = this.noButton.IsChecked.Value;

            bool repeating = tasks[taskIndex].getRepeatability();

            /*
             * TODO: if the repeatable value changes the disposable/repeatable task needs to be changed
             */
            if (yes == true)
            {
                if (repeating != yes)
                {
                    userObject.getUserToDoList()[0].switchTaskType(taskIndex);
                }
            }
            else if (no == true)
            {
                if (repeating == no)
                {
                    userObject.getUserToDoList()[0].switchTaskType(taskIndex);
                }
            }

            //subtasks

            int index = 0;

            foreach (KeyValuePair <int, SubTask> entry in subtasks)
            {
                subs.Add(entry.Value);
                String title = "";
                String notes = "";

                DateTime date = new DateTime();


                /*
                 * TODO: if DateTime doesn't have a value it crashes :)
                 */
                if (index == 0)
                {
                    title = this.sub1NameBox.Text;
                    notes = this.sub1NotesBox.Text;

                    if (this.sub1DatePicker.SelectedDate == null)
                    {
                        date = new DateTime();
                    }
                    else
                    {
                        date = this.sub1DatePicker.SelectedDate.Value.Date;
                    }
                }
                else if (index == 1)
                {
                    title = this.sub2NameBox.Text;
                    notes = this.sub2NotesBox.Text;
                    if (this.sub2DatePicker.SelectedDate == null)
                    {
                        date = new DateTime();
                    }
                    else
                    {
                        date = this.sub2DatePicker.SelectedDate.Value.Date;
                    }
                }
                else if (index == 2)
                {
                    title = this.sub3NameBox.Text;
                    notes = this.sub3NotesBox.Text;
                    if (this.sub3DatePicker.SelectedDate == null)
                    {
                        date = new DateTime();
                    }
                    else
                    {
                        date = this.sub3DatePicker.SelectedDate.Value.Date;
                    }
                }

                entry.Value.setTitle(title);
                entry.Value.setNotes(notes);


                if (date != new DateTime())
                {
                    entry.Value.setDueDate(date);
                }


                index++;
            }

            CompleteTask comp = new CompleteTask(userObject, taskIndex);

            NavigationService.Navigate(comp);
        }