Пример #1
0
        /// <summary>
        /// Constructor of the <see cref="MainWindow"/> class
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            _taskPanelViewer = new TaskPanelViewer();
            _taskPanelViewer.SetTasks(AccessDBManager.FindTasksFromDB());
            MainContentArea.Content = _taskPanelViewer;

            AddHandler(TaskPanelViewer.TaskEditEventFromPanelViewer,
                       new RoutedEventHandler(TaskEditEventFromMainWindowHandler));
            AddHandler(TaskPanelViewer.TaskDeleteEventFromPanelViewer,
                       new RoutedEventHandler(TaskDeleteEventFromMainWindowHandler));
            AddHandler(TaskPanelViewer.TaskCompletedEventFromPanelViewer,
                       new RoutedEventHandler(TaskCompletedEventFromMainWindowHandler));
            AddHandler(DeletionTaskControl.DeleteTaskConfirmEvent,
                       new RoutedEventHandler(DeleteTaskConfirmEventHandler));
            AddHandler(DeletionTaskControl.DeleteTaskCancelEvent,
                       new RoutedEventHandler(DeleteTaskCancelEventHandler));
            AddHandler(AddTaskControl.AddTaskConfirmEvent,
                       new RoutedEventHandler(AddTaskConfirmEventHandler));
            AddHandler(AddTaskControl.AddTaskCancelEvent,
                       new RoutedEventHandler(AddTaskCancelEventHandler));
            AddHandler(EditTaskControl.EditTaskConfirmEvent,
                       new RoutedEventHandler(EditTaskConfirmEventHandler));
            AddHandler(EditTaskControl.EditTaskCancelEvent,
                       new RoutedEventHandler(EditTaskCancelEventHandler));
        }
Пример #2
0
        /// <summary>
        /// Function triggered when the user clicked on the 'Done' button inside a task panel
        /// </summary>
        /// <param name="sender">The sender <see cref="object"/></param>
        /// <param name="e">The sender <see cref="RoutedEventArgs"/> events</param>
        private void TaskCompletedEventFromMainWindowHandler(object sender, RoutedEventArgs e)
        {
            TaskInfoArgs args = e as TaskInfoArgs;

            AccessDBManager.UpdateTaskInDB(args.TaskInfo);

            //Update from the DB
            _taskPanelViewer.SetTasks(AccessDBManager.FindTasksFromDB());
        }
Пример #3
0
        /// <summary>
        /// Function triggered when the 'Confirm' button is clicked on the <see cref="EditTaskControl"/>
        /// </summary>
        /// <param name="sender">The sender <see cref="object"/></param>
        /// <param name="e">The sender <see cref="RoutedEventArgs"/> events</param>
        private void EditTaskConfirmEventHandler(object sender, RoutedEventArgs e)
        {
            TaskInfoArgs args = e as TaskInfoArgs;

            AccessDBManager.UpdateTaskInDB(args.TaskInfo);

            //Update from the DB
            _taskPanelViewer.SetTasks(AccessDBManager.FindTasksFromDB());

            AddTaskButton.Visibility = Visibility.Visible;
            MainContentArea.Content  = _taskPanelViewer;
        }