Пример #1
0
        private void OnSelectTreeViewItem(object sender, RoutedEventArgs e)
        {
            CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;

            if (selected != null)
            {
                if (selected.dateBegin != null)
                {
                    beginDatePicker.SelectedDate = DateTime.Parse(selected.dateBegin);
                }
                if (selected.dateEnd != null)
                {
                    endDatePicker.SelectedDate = DateTime.Parse(selected.dateEnd);
                }
                if (selected.comment != null)
                {
                    comment.Document.Blocks.Clear();
                    comment.Document.Blocks.Add(new Paragraph(new Run(selected.comment)));
                }
                statusText.Text = "Taches: " + m_containers[currentIndex].m_Tasks.Count;
                int sTaskCount = 0;
                for (int i = 0; i < m_containers[currentIndex].m_Tasks.Count; ++i)
                {
                    sTaskCount += m_containers[currentIndex].m_Tasks[i].Items.Count;
                }
                statusText.Text += " Sous-Taches: " + sTaskCount;
            }
        }
Пример #2
0
        public void removeItem(CustomTreeViewItem item)
        {
            try
            {
                int i     = 0;
                int index = -1;
                while (i < m_Tasks.Count && index < 0)
                {
                    index = m_Tasks[i].Items.IndexOf(item);
                    ++i;
                }

                if (item.parent != null && index >= 0)
                {
                    int parent_index = m_Tasks.IndexOf(item.parent);
                    m_Tasks[parent_index].Items.Remove(item);
                }
                else if (item.parent == null)
                {
                    m_Tasks.Remove(item);
                }
                taches t = req.getSTaches(bdd, item.Title.Text);
                req.supTaches(bdd, t);
            }
            catch (Exception)
            {
                MessageBox.Show("Une erreur est survenu lors de l'enregistrement des tâches en attente: " + "Veuillez réessayer ultérieurement et redémarrer l'application", "Media Task Manager", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #3
0
        private void beginDatePicker_CalendarClosed(object sender, RoutedEventArgs e)
        {
            CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;

            if (selected != null)
            {
                selected.dateBegin = beginDatePicker.Text;
            }
        }
Пример #4
0
        private void unselectItem()
        {
            CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;

            if (selected != null)
            {
                selected.IsSelected = false;
            }
        }
Пример #5
0
        private void comment_KeyUp(object sender, KeyEventArgs e)
        {
            CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;

            if (selected != null)
            {
                string content = new TextRange(comment.Document.ContentStart, comment.Document.ContentEnd).Text;
                selected.comment = content;
            }
        }
Пример #6
0
 public int Contains(string name)
 {
     for (int i = 0; i < this.Items.Count; ++i)
     {
         CustomTreeViewItem item = this.Items[i] as CustomTreeViewItem;
         if (item.Title.Text == name)
         {
             return(0);
         }
     }
     return(-1);
 }
Пример #7
0
        private void addSubTask_click(object sender, RoutedEventArgs e)
        {
            CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;

            if (selected != null)
            {
                if (selected.chkBox.IsEnabled == false && (selected.parent == null || (selected.parent != null && selected.parent.chkBox.IsEnabled == false)))
                {
                    MessageBox.Show("Impossible d'ajouter une Sous-Tache!", "Media Task Manager", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }
                newTask = new NewTask();
                newTask.Show();
                newTask.OnSaveEvent += new RoutedEventHandler(newTask_OnSaveNewSubTask);
            }
        }
Пример #8
0
        /*                      Recherche une tâche                         */
        private void search_Click(object sender, RoutedEventArgs e)
        {
            CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;

            foreach (CustomTreeViewItem item in m_containers[currentIndex].m_Tasks)
            {
                if (searchText.Text == item.Title.Text)
                {
                    selected.IsSelected = false;
                    item.IsSelected     = true;
                }
                foreach (CustomTreeViewItem subitem in item.Items)
                {
                    if (searchText.Text == subitem.Title.Text)
                    {
                        selected.IsSelected = false;
                        subitem.IsSelected  = true;
                    }
                }
            }
        }
Пример #9
0
        public void addItem(CustomTreeViewItem parent, string title, string beginDate, string endDate, string comment, bool done)
        {
            CustomTreeViewItem item = new CustomTreeViewItem(title);

            item.parent           = parent;
            item.comment          = comment;
            item.dateBegin        = beginDate;
            item.dateEnd          = endDate;
            item.chkBox.IsChecked = done;
            item.IsExpanded       = true;
            if (parent != null)
            {
                item.chkBox.IsEnabled = !done;
                int index = (m_Tasks.IndexOf(parent) >= 0) ? m_Tasks.IndexOf(parent) : 0;
                m_Tasks[index].Items.Add(item);
            }
            else
            {
                item.chkBox.IsEnabled = true;
                m_Tasks.Add(item);
            }
        }
Пример #10
0
        /// Supprime la tache selectionné ainsi que les sous-tâches qui y sont relié
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void remTask_click(object sender, RoutedEventArgs e)
        {
            try
            {
                taches             remTask;
                CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;

                string nom = treeView.SelectedItem.ToString();
                remTask = req.getSTaches(bdd, selected.Title.Text);

                List <taches> subTaskRem = req.getSousTaches(bdd, selected.Title.Text);
                foreach (taches t in subTaskRem)
                {
                    m_containers[currentIndex].removeItem(selected);
                }
                m_containers[currentIndex].removeItem(selected);
            }
            catch (Exception)
            {
                MessageBox.Show("Une erreur est survenu lors de la suppression: " + "Veuillez réessayer ultérieurement et redémarrer l'application", "Media Task Manager", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #11
0
 /// <summary>
 /// Ajout une sous-tâches
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void newTask_OnSaveNewSubTask(object sender, RoutedEventArgs e)
 {
     try
     {
         CustomTreeViewItem selected = treeView.SelectedItem as CustomTreeViewItem;
         if (selected != null)
         {
             if (selected.parent != null)
             {
                 selected = selected.parent;
             }
             string content = new TextRange(newTask.comment.Document.ContentStart, newTask.comment.Document.ContentEnd).Text;
             string Name    = "Sous-Tache";
             int    i       = 0;
             while (selected.Contains(Name + i) != -1)
             {
                 ++i;
             }
             Name += i;
             m_containers[currentIndex].addItem(selected, Name, newTask.beginDatePicker.Text, newTask.endDatePicker.Text, content, false);
             taches newSubTask = new taches();
             newSubTask.label_tache        = Name;
             newSubTask.commentaire        = content;
             newSubTask.date_debut         = newTask.beginDatePicker.SelectedDate;
             newSubTask.date_fin           = newTask.endDatePicker.SelectedDate;
             newSubTask.label_tache_parent = selected.Title.Text;
             newSubTask.effectuer          = false;
             req.ajoutTaches(bdd, newSubTask);
             newTask.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Une erreur est survenu lors de l'ajout d'une sous-tâches: " + "Veuillez réessayer ultérieurement et redémarrer l'application", "Media Task Manager", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }