예제 #1
0
        public void DeleteTask(Chores chore)
        {
            var oldTask = chores.Find(t => t.Id == chore.Id);

            chores.Remove(oldTask);
            NavigationController.PopViewController(true);
        }
예제 #2
0
        public void SaveTask(Chores chore)
        {
            //var oldTask = chores.Find(t => t.Id == chore.Id);
            var db = DBSingleton.DB;

            db.Insert(chore);

            NavigationController.PopViewController(true);
        }
예제 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AddButton.Clicked += (sender, e) =>
            {
                // first, add the task to the underlying data
                var newId    = chores[chores.Count - 1].Id + 1;
                var newChore = new Chores {
                    Id = newId
                };
                //chores.Add(newChore);

                // then open the detail view to edit it
                var detail = Storyboard.InstantiateViewController("detail") as TaskDetailViewController;
                detail.SetTask(this, newChore);
                NavigationController.PushViewController(detail, true);
            };
        }
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            var db = DBSingleton.DB;

            db.CreateTable <Chores>();

            if (db.Table <Chores>().Count() == 0)
            {
                System.Console.WriteLine("chores are empty");

                var c = new Chores();
                c.Name  = "James333";
                c.Notes = "james2";
                c.Done  = false;

                db.Insert(c);
            }

            return(true);
        }
 public void SetTask(ItemViewController d, Chores task)
 {
     Delegate    = d;
     currentTask = task;
 }