Beispiel #1
0
 private void OnMoveCompleteComamnd(Card card)
 {
     if (!CompletedItems.Contains(card))
     {
         TodoItems.Remove(card);
         DoingItems.Remove(card);
         CompletedItems.Add(card);
     }
     _cardsManager.Save(TodoItems, DoingItems, CompletedItems);
 }
Beispiel #2
0
 private void OnMoveToDoCommand(Card card)
 {
     if (!TodoItems.Contains(card))
     {
         DoingItems.Remove(card);
         CompletedItems.Remove(card);
         TodoItems.Add(card);
     }
     _cardsManager.Save(TodoItems, DoingItems, CompletedItems);
 }
Beispiel #3
0
 private void OnDeleteCommand(Card card)
 {
     if (TodoItems != null)
     {
         TodoItems.Remove(card);
     }
     if (DoingItems != null)
     {
         DoingItems.Remove(card);
     }
     if (CompletedItems != null)
     {
         CompletedItems.Remove(card);
     }
     _cardsManager.Save(TodoItems, DoingItems, CompletedItems);
 }
Beispiel #4
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                CompletedItems.Clear();

                object locker = new object(); // class level private field
                                              // rest of class code
                string dbPath = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                    "database.db3");
                // dbPath contains a valid file path for the database file to be stored
                lock (locker)
                {
                    var db = new SQLiteConnection(dbPath);

                    db.CreateTable <Item>(); //checks if database exists and cretaes a new one if it doesn't

                    Console.WriteLine("Reading data from ExecuteLoadItemCommand in itemsviewmodel\n");
                    var table = db.Table <Item>();
                    foreach (var s in table)
                    {
                        if (s.Completed == true)
                        {
                            CompletedItems.Add(s);                              //add all not completed items in the data base to the observableCollection
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #5
0
        private void OnMoveToPriorCommand(Card card)
        {
            if (!TodoItems.Contains(card))
            {
                if (DoingItems.Contains(card))
                {
                    DoingItems.Remove(card);
                    TodoItems.Add(card);
                }

                else if (CompletedItems.Contains(card))
                {
                    CompletedItems.Remove(card);
                    DoingItems.Add(card);
                }
            }
            _cardsManager.Save(TodoItems, DoingItems, CompletedItems);
        }
Beispiel #6
0
        private void Consume(CancellationToken cancellationToken)
        {
            var consumer = _consumerFactory();

            while (!cancellationToken.IsCancellationRequested)
            {
                TProducerOutput msg;
                if (_processingQueue.TryDequeue(out msg))
                {
                    var resp = consumer.Process(msg);
                    _completeQueue.Enqueue(resp);
                    CompletedItems.Add(resp);
                }
                else if (_producerComplete)
                {
                    // Done processing all items
                    return;
                }
                Thread.Yield();
            }
        }
Beispiel #7
0
        public async Task ExecuteDeleteCommand(Item item)
        {
            await DataStore.DeleteItemAsync(item.Id);

            CompletedItems.Remove(item);
        }
 public void RefreshDensity()
 {
     WriteLineIf(CompletedCount >= MeasurementCountForAverage, $"Current Density is : {Density}, Count : {Count}");
     WriteLineIf(CompletedCount >= MeasurementCountForAverage, $"Current Density is : {CompletedItems.Average(md => md.Density)}, Completed Count :{CompletedCount}");
     OnPropertyChanged(new PropertyChangedEventArgs(nameof(Density)));
 }