Esempio n. 1
0
        private async Task LoadTasks()
        {
            var result = await apiService.GetAllTasks();

            if (result.HttpResponse.IsSuccessStatusCode)
            {
                foreach (var item in result.Data)
                {
                    switch (item.Status)
                    {
                    case 0:
                        ToDo.Add(ViewModelHelper.Get(item));
                        break;

                    case 1:
                        Doing.Add(ViewModelHelper.Get(item));
                        break;

                    case 2:
                        Done.Add(ViewModelHelper.Get(item));
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        public void RefreshMainWindow()
        {
            ToDo.Clear();
            Doing.Clear();
            Backlog.Clear();
            Done.Clear();

            var result = readDbDataToDisplay();

            foreach (var i in result)
            {
                if (i.States == BackLog.State.IsToDo)
                {
                    ToDo.Add(i);
                }
                else if (i.States == BackLog.State.IsDoing)
                {
                    Doing.Add(i);
                }
                else if (i.States == BackLog.State.Backlog)
                {
                    Backlog.Add(i);
                }
                else
                {
                    Done.Add(i);
                }
            }
        }
        public void Set(TrelloCard card, CardStatus status, bool propagateToNext = false)
        {
            if (!BoardAnalysis.Cards.Contains(card))
            {
                BoardAnalysis.Cards.Add(card);
            }
            switch (status)
            {
            case CardStatus.Other:
                if (Other.Contains(card))
                {
                    break;
                }

                Other.Add(card);
                removeFrom(card, Doing, Done);
                break;

            case CardStatus.Doing:
                if (Doing.Contains(card))
                {
                    break;
                }

                Doing.Add(card);
                removeFrom(card, Done, Other);
                break;

            case CardStatus.Done:
                if (Done.Contains(card))
                {
                    break;
                }

                Done.Add(card);
                removeFrom(card, Other, Doing);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(status), status, null);
            }
            if (propagateToNext)
            {
                ((PeriodCardsStatus)Next(false))?.Set(card, status);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Method that will refresh all the data in the view. Specifically it will add a backlog item to the new correct Observable list
 /// This is called from the edit Command, so we after deleted the item from the prvious view, add it to the new view.
 /// </summary>
 /// <param name="item">Specific item you want to change to a new listbox in the view</param>
 public void RefreshMainWindow(BackLog item)
 {
     if (item.States == BackLog.State.IsToDo)
     {
         ToDo.Add(item);
     }
     else if (item.States == BackLog.State.IsDoing)
     {
         Doing.Add(item);
     }
     else if (item.States == BackLog.State.Backlog)
     {
         Backlog.Add(item);
     }
     else
     {
         Done.Add(item);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Ctor. Need to read all data from WebAPI (Database), and populate the above ObservableCollections.
        /// These bind to 4 different listbox in View.
        /// </summary>
        public BackLogController()
        {
            if (_client.BaseAddress == null)
            {
                _client.BaseAddress = new Uri("http://localhost:4200/");

                _client.DefaultRequestHeaders.Accept.Clear();
                _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            }

            var result = readDbDataToDisplay();

            foreach (var i in result)
            {
                if (i.States == BackLog.State.IsToDo)
                {
                    ToDo.Add(i);
                }
                else if (i.States == BackLog.State.IsDoing)
                {
                    Doing.Add(i);
                }
                else if (i.States == BackLog.State.Backlog)
                {
                    Backlog.Add(i);
                }
                else
                {
                    Done.Add(i);
                }
            }

            //Here I read settings file for background color of main window.
            string color = Properties.Settings.Default.Color;
            var    brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));

            BackgroundColor = brush;

            NotifyPropertyChanged();

            UpdateChart();
        }
Esempio n. 6
0
        private void SplitTask()
        {
            Debug.WriteLine($"Number of items in Task: {Task.Count}");
            foreach (var task in Task)
            {
                switch (task.Progress)
                {
                case Progress.ToDo:
                    ToDo.Add(task);
                    break;

                case Progress.Doing:
                    Doing.Add(task);
                    break;

                case Progress.Done:
                    Done.Add(task);
                    break;

                default:
                    break;
                }
            }
        }