Exemplo n.º 1
0
        public App()
        {
            InitializeComponent();

            MainPage = new ToDoPage();
            ToDoHandler.LoadToDoListAsync();
        }
Exemplo n.º 2
0
 /// <summary>
 /// When modifying the sorting mode, the ToDoHandler reorder the ToDo list
 /// And we make sure that the UI gets updated
 /// </summary>
 private void Picker_OnSelectedIndexChanged(object sender, EventArgs e)
 {
     ToDoHandler.Ordering = ConvertStringToEnum(((Picker)sender).SelectedItem.ToString());
     ToDoHandler.Order();
     ToDoListView.ItemsSource = null;
     ToDoListView.ItemsSource = viewModel.ToDoList;
 }
Exemplo n.º 3
0
        public void Insert()
        {
            var td = new DataModels.ToDo {
                Title = "abcd"
            };

            ToDoHandler.InsertToDo(td);
            Assert.AreNotEqual(0, td.Id);
        }
Exemplo n.º 4
0
        public void Initialize()
        {
            var td = new DataModels.ToDo {
                Title = "Blah!"
            };

            ToDoHandler.InsertToDo(td);
            _latestToDoId = td.Id;
        }
Exemplo n.º 5
0
        /// <summary>
        /// If the User hits the done button, the new ToDo will be added
        /// to the list via the `ToDoHandler`
        /// (Warning: the input is not validated, the user is allowed to enter empty string, or anything else)
        /// </summary>
        private void DoneButton_OnClicked(object sender, EventArgs e)
        {
            var toDo = new Model.ToDo {
                DateTime = DateTime.Now, State = State.TODO, Title = ToDoTitle.Text
            };

            ToDoHandler.Add(toDo);
            Navigation.PopModalAsync();
        }
Exemplo n.º 6
0
        public void UpdateOneExists()
        {
            var td = ToDoHandler.GetToDo(_latestToDoId);

            td.Title = "Hi There!";
            ToDoHandler.UpdateToDo(td);
            var todoFromDb = ToDoHandler.GetToDo(_latestToDoId);

            Assert.AreEqual("Hi There!", todoFromDb.Title);
        }
Exemplo n.º 7
0
        public void GetOneNotExists()
        {
            var td = ToDoHandler.GetToDo(_latestToDoId + 5000);

            Assert.IsNotNull(td);
        }
Exemplo n.º 8
0
        public void GetOne()
        {
            var td = ToDoHandler.GetToDo(_latestToDoId);

            Assert.IsNotNull(td);
        }
Exemplo n.º 9
0
        public void GetAll()
        {
            var length = ToDoHandler.GetToDos().Count;

            Assert.AreNotEqual(0, length);
        }
Exemplo n.º 10
0
 public void Cleanup()
 {
     ToDoHandler.WipeDB();
 }
Exemplo n.º 11
0
 public GenericCommandResult MarkAsUndone([FromBody] MarkAsUndoneCommand command,
                                          [FromServices] ToDoHandler handler)
 {
     command.User = "******";
     return((GenericCommandResult)handler.Handle(command));
 }
Exemplo n.º 12
0
 public GenericCommandResult Create([FromBody] CreateToDoCommands command,
                                    [FromServices] ToDoHandler handler)
 {
     command.User = "******";
     return((GenericCommandResult)handler.Handle(command));
 }
Exemplo n.º 13
0
 protected override void OnResume()
 {
     ToDoHandler.LoadToDoListAsync();
 }
Exemplo n.º 14
0
 protected override void OnSleep()
 {
     ToDoHandler.SaveToDoList();
 }
Exemplo n.º 15
0
 protected override void OnStart()
 {
     ToDoHandler.LoadToDoListAsync();
 }
Exemplo n.º 16
0
 /// <summary>
 /// When the save is hit, the ToDoHandler takes care of the saving process
 /// </summary>
 private async Task SaveButton_OnClicked(object sender, EventArgs e)
 {
     await ToDoHandler.SaveToDoList();
 }