示例#1
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0) {
				task = TaskyApp.Current.TodoManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			SetContentView(Resource.Layout.TaskDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.NameText);
			notesTextEdit = FindViewById<EditText>(Resource.Id.NotesText);
			saveButton = FindViewById<Button>(Resource.Id.SaveButton);

			// TODO: find the Checkbox control and set the value
			doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
			doneCheckbox.Checked = task.Done;

			// find all our controls
			cancelDeleteButton = FindViewById<Button>(Resource.Id.CancelDeleteButton);
			
			// set the cancel delete based on whether or not it's an existing task
			cancelDeleteButton.Text = (task.ID == 0 ? "Cancel" : "Delete");
			
			nameTextEdit.Text = task.Name; 
			notesTextEdit.Text = task.Notes;

			// button clicks 
			cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
			saveButton.Click += (sender, e) => { Save(); };
		}
示例#2
0
		public TodoItemDialog (TodoItem item)
		{
			Name = item.Name;
			Notes = item.Notes;
			// TODO: ensure the completed property is displayed on the screen
			Done = item.Done;
		}
 public TodoItemDialog(TodoItem item)
 {
     Name = item.Name;
     Notes = item.Notes;
     Reward = item.Reward > 0 ? item.Reward.ToString() : String.Empty;
     // TODO: ensure the completed property is displayed on the screen
     Done = item.Done;
 }
示例#4
0
		protected void ShowTaskDetails(TodoItem item)
		{
			currentItem = item;
			taskDialog = new TodoItemDialog (currentItem);
			context = new BindingContext (this, taskDialog, "Task Details");
			detailsScreen = new DialogViewController (context.Root, true);
			ActivateController(detailsScreen);
		}
示例#5
0
		public int SaveItem (TodoItem item) 
		{
			lock (locker) {
				if (item.ID != 0) {
					database.Update(item);
					return item.ID;
				} else {
					return database.Insert(item);
				}
			}
		}
 public int SaveItem(TodoItem item)
 {
     return 0;
        //         lock (locker) {
     //	if (item.ID != 0) {
     //		database.Update(item);
     //		return item.ID;
     //	} else {
     //		return database.Insert(item);
     //	}
     //}
 }
        public async Task CreateItemTest()
        {
            var todoContractMgr = new TodoContractManager("http://localhost:8000",
                "http://strato-dev4.blockapps.net/eth/v1.2");
            var user = await User.GetUser("charlie", "test");


            var todo = new TodoItem
            {
                Done = false,
                Name = "Paint wall",
                Notes = "paint red",
                Reward = 2,
                //ID = "4009e23d31d50609b5ab1b7da6e8aa6720ae8215"
            };

            var items = await todoContractMgr.SaveItem(todo, user, user.Accounts[0]);
            var x = "sup";
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            string taskID = Intent.GetStringExtra("TaskID");
            if (taskID != null)
            {
                //task = TaskyApp.Current.TodoManager.GetTask(taskID);
                Task<TodoItem> asyncTask = Task.Run(() => TaskyApp.Current.TodoContractMngr.GetItem(taskID));
                task = asyncTask.Result;
            }

            // set our layout to be the home screen
            SetContentView(Resource.Layout.TaskDetails);
            nameTextEdit = FindViewById<EditText>(Resource.Id.NameText);
            notesTextEdit = FindViewById<EditText>(Resource.Id.NotesText);
            saveButton = FindViewById<Button>(Resource.Id.SaveButton);
            rewardTextEdit = FindViewById<EditText>(Resource.Id.RewardText);

            // TODO: find the Checkbox control and set the value
            doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
            doneCheckbox.Checked = task.Done;

            // find all our controls
            cancelDeleteButton = FindViewById<Button>(Resource.Id.CancelDeleteButton);

            // set the cancel delete based on whether or not it's an existing task
            cancelDeleteButton.Text = (task.ID == null ? "Cancel" : "Delete");

            nameTextEdit.Text = task.Name;
            notesTextEdit.Text = task.Notes;
            rewardTextEdit.Text = task.Reward.ToString();

            // button clicks 
            cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
            saveButton.Click += (sender, e) => { Save(); };
        }
示例#9
0
		public int SaveTask (TodoItem item)
		{
			return repository.SaveTask(item);
		}
示例#10
0
		public int SaveTask (TodoItem item)
		{
			return db.SaveItem(item);
		}