예제 #1
0
        public WTDTaskViewModel()
        {
            _wtdTaskManager      = new WTDTaskManager();
            _currentCalendarDate = DateTime.Now;
            _dates     = new List <DateTime>();
            _taskDates = new Dictionary <DateTime, List <int> >();

            MessagingCenter.Subscribe <WTDTaskEditViewModel>(this, "TaskChanged", (message) => {
                GetTasks();
            });
            MessagingCenter.Subscribe <WTDTaskEditViewModel>(this, "TaskUnchanged", (message) => {
                SelectedItem = null;
            });
        }
        public WTDTaskEditViewModel()
        {
            Date = DateTime.Now;

            _wtdTaskManager = new WTDTaskManager();
            _noteManager    = new NoteManager();
            TaskTypes       = GetTaskTypes();

            MessagingCenter.Subscribe <WTDTaskViewModel, WTDTask>(this, "EditTask", async(message, args) =>
            {
                _selectedTask = args;
                Date          = _selectedTask.Date;
                if (_selectedTask.ID > 0)
                {
                    Name = _selectedTask.Name;

                    TypeStr = GetType(_selectedTask.TypeId);

                    var notesResult = await _noteManager.GetNote((int)NoteType.Task, _selectedTask.ID);
                    Notes           = notesResult == null ? string.Empty : notesResult.Notes;
                }
            });
        }