Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            tasksViewModel = new TodoItemsViewModel();

            addTaskButton = FindViewById <Button>(Resource.Id.btn_add);
            if (addTaskButton != null)
            {
                addTaskButton.Click += delegate {
                    Log.Debug(TaskyApp.TAG, "addTaskButton pressed");
                    StartActivity(typeof(TodoItemActivity));
                };
            }

            taskListView = FindViewById <ListView>(Resource.Id.lv_task_list);
            if (taskListView != null)
            {
                taskListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                {
                    Log.Debug(TaskyApp.TAG, "click item {0} and ID {1}", e.Position, e.Id);
                    var taskDetails = new Intent(this, typeof(TodoItemActivity));
                    taskDetails.PutExtra("TaskID", (int)e.Id);
                    StartActivity(taskDetails);
                };
            }

            listAdapter = new TodoItemListAdapter(this, tasksViewModel.GetTasks());
        }
Ejemplo n.º 2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            List <TodoItem> tasks = (List <TodoItem>)tasksViewModel.GetTasks();

            TableView.Source = new RootTableSource(tasks.ToArray());
        }
Ejemplo n.º 3
0
        protected override void OnResume()
        {
            base.OnResume();

            taskListView.Adapter = new TodoItemListAdapter(this, tasksViewModel.GetTasks());
        }