예제 #1
0
        private void SortByTag(Tag tag, bool Selected)
        {
            if (Selected)
            {
                foreach (Todo item in currentInventory)
                {
                    for (int o = 0; o < item.TagItems.Count; o++)
                    {
                        if (item.TagItems[o].ID == tag.item.ID)
                        {
                            //MessageBox.Show("Succes");

                            Itembar itembar = new Itembar(item);
                            itembar.Click  += new EventHandler(this.Itembar_Click);
                            itembar.Remove += new EventHandler(this.Itembar_Remove);
                            itembar.Update += new EventHandler(this.Itembar_Update);

                            TodoItemsStackPanel.Children.Add(itembar);
                        }
                    }
                }
            }
            else
            {
                foreach (var item in currentInventory)
                {
                    Itembar itembar = new Itembar(item);
                    itembar.Click  += new EventHandler(this.Itembar_Click);
                    itembar.Remove += new EventHandler(this.Itembar_Remove);
                    itembar.Update += new EventHandler(this.Itembar_Update);

                    TodoItemsStackPanel.Children.Add(itembar);
                }
            }
        }
예제 #2
0
        private void LoadTodoList(string searchString)
        {
            currentInventory = todoManager.Filter(filterMethod);
            currentInventory = todoManager.Sort(SortMethods.ID, currentInventory);
            currentInventory = todoManager.FindAll(searchString, currentInventory);

            if (TodoItemsStackPanel.Children.Count != 0)
            {
                TodoItemsStackPanel.Children.Clear();
            }

            foreach (var item in currentInventory)
            {
                Itembar itembar = new Itembar(item);
                itembar.Click  += new EventHandler(this.Itembar_Click);
                itembar.Remove += new EventHandler(this.Itembar_Remove);
                itembar.Update += new EventHandler(this.Itembar_Update);

                itembar.UpdateChosenTag += new EventHandler(this.Itembar_UpdateChosenTag);

                TodoItemsStackPanel.Children.Add(itembar);
            }

            OnItemCountChanged();
        }
예제 #3
0
        private void tagBar_RemoveTag(object sender, EventArgs e)
        {
            Tag tag = sender as Tag;

            //MessageBox.Show(tag.tagItem.Content + Environment.NewLine + tag.tagItem.TagColor + Environment.NewLine + tag.tagItem.ID);
            currentInventory = todoManager.Filter(FilterMethods.None);
            for (int u = 0; u < currentInventory.Count; u++)
            {
                for (int i = 0; i < currentInventory[u].TagItems.Count; i++)
                {
                    if (currentInventory[u].TagItems[i].ID == tag.item.ID)
                    {
                        currentInventory[u].TagItems.Remove(currentInventory[u].TagItems.Find(x => x.ID == tag.item.ID));
                        todoManager.Update(currentInventory[u]);

                        break;
                    }
                }
            }
            currentInventory = todoManager.Filter(filterMethod);

            if (TodoItemsStackPanel.Children.Count != 0)
            {
                TodoItemsStackPanel.Children.Clear();
            }
            foreach (var item in currentInventory)
            {
                Itembar itembar = new Itembar(item);
                itembar.Click  += new EventHandler(this.Itembar_Click);
                itembar.Remove += new EventHandler(this.Itembar_Remove);
                itembar.Update += new EventHandler(this.Itembar_Update);

                TodoItemsStackPanel.Children.Add(itembar);
            }
        }
        public DetailsPanel(Itembar itembar)
        {
            this.DataContext = this;

            //Copy the item bar
            this.itembar = itembar;


            //Get item bar's todo properties
            this.todo = itembar.todo;


            InitializeComponent();


            //Load in available tag choices
            LoadAvailableTagItemsChoices();


            //Load in the current item's tags
            LoadTagItems();


            ShowReminderDetails();
        }
예제 #5
0
        private void Itembar_SaveNewTask(object sender, EventArgs e)
        {
            //get triggered item bar;
            Itembar itembar = sender as Itembar;

            //create new task
            todoManager.Update(itembar.todo);
        }
예제 #6
0
        private void Itembar_Remove(object sender, EventArgs e)
        {
            //get triggered item bar;
            Itembar itembar = sender as Itembar;

            TodoItemsStackPanel.Children.Remove(itembar);
            currentInventory.Remove(itembar.todo);
            todoManager.Remove(itembar.todo);

            OnItemCountChanged();
        }
예제 #7
0
        private void Itembar_Click(object sender, EventArgs e)
        {
            //get triggered item bar;
            Itembar itembar = sender as Itembar;

            //create details creation panel and set close event handler
            DetailsPanel detailsPanel = new DetailsPanel(itembar);

            detailsPanel.Close           += new EventHandler(this.Panel_Close);
            detailsPanel.UpdateChosenTag += new EventHandler(Itembar_UpdateChosenTag);
            //show
            DataGrid.Children.Add(detailsPanel);
        }
예제 #8
0
        public void NewTaskButton_Click(object sender, RoutedEventArgs e)
        {
            Itembar itembar = new Itembar();

            itembar.ID = currentInventory.Count;
            itembar.todo.CreationDateTime = DateTime.Now;

            itembar.Click           += new EventHandler(this.Itembar_Click);
            itembar.SaveNewTask     += new EventHandler(this.Itembar_SaveNewTask);
            itembar.Remove          += new EventHandler(this.Itembar_Remove);
            itembar.Update          += new EventHandler(this.Itembar_Update);
            itembar.UpdateChosenTag += new EventHandler(this.Itembar_UpdateChosenTag);

            TodoItemsStackPanel.Children.Insert(0, itembar);
            currentInventory.Add(itembar.todo);
            todoManager.Add(itembar.todo);

            OnItemCountChanged();
        }
예제 #9
0
        private void LoadTodoList(FilterMethods filterMethod, SortMethods sortMethods)
        {
            currentInventory = todoManager.Filter(filterMethod);
            currentInventory = todoManager.Sort(sortMethods, currentInventory);

            if (TodoItemsStackPanel.Children.Count != 0)
            {
                TodoItemsStackPanel.Children.Clear();
            }

            foreach (var item in currentInventory)
            {
                Itembar itembar = new Itembar(item);
                itembar.Click  += new EventHandler(this.Itembar_Click);
                itembar.Remove += new EventHandler(this.Itembar_Remove);
                itembar.Update += new EventHandler(this.Itembar_Update);

                itembar.UpdateChosenTag += new EventHandler(this.Itembar_UpdateChosenTag);

                TodoItemsStackPanel.Children.Add(itembar);
            }
        }
예제 #10
0
        private void Itembar_UpdateChosenTag(object sender, EventArgs e)
        {
            Itembar itembar = sender as Itembar;

            todoManager.Update(itembar.todo);
        }