コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            var sqliteFilename = "TaskDB.db3";
            string libraryPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var path = Path.Combine(libraryPath, sqliteFilename);
            var conn = new Connection(path);

            var taskRepository = new TaskRepository(conn, "");
            taskManager = new TaskManager(taskRepository);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.addButton);

            button.Click += delegate {
                var todoText = FindViewById<EditText> (Resource.Id.todoItemText);
                taskManager.NewTodoItem.Text = todoText.Text;
                taskManager.AddTodoItem();
                todoText.Text = "";
                StartService(new Intent(CustomActions.TODO_SET_GEOFENCE));

            };

            var taskListView = FindViewById<ListView> (Resource.Id.listTasks);
            var taskListAdapter = new TaskListAdapter (this, taskManager);
            taskListView.Adapter = taskListAdapter;

            //Intent intent = new Intent (this, typeof(GeofencingHelper));
            StartService(new Intent(CustomActions.TODO_START_LOCATION_MONITORING));
        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            taskManager = new TaskManager();

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.addButton);

            button.Click += delegate {
                var todoText = FindViewById<EditText> (Resource.Id.todoItemText);
                taskManager.NewTodoItem.Text = todoText.Text;
                taskManager.AddTodoItem();
                todoText.Text = "";
            };

            var taskListView = FindViewById<ListView> (Resource.Id.listTasks);
            var taskListAdapter = new TaskListAdapter (this, taskManager.TodoItems);
            taskListView.Adapter = taskListAdapter;
        }