Пример #1
0
 public void Update (TaskItem item)
 {
     ID = item.ID;
     Name = item.Name;
     Notes = item.Notes;
     Done = item.Done;
 }
		protected void ShowTaskDetails (TaskItem taskItem)
		{
			currentTaskItem = taskItem;
			taskItemDialog = new TaskDialog (taskItem);
			
			var title = Foundation.NSBundle.MainBundle.LocalizedString ("Task Details", "Task Details");
			context = new LocalizableBindingContext (this, taskItemDialog, title);
			detailsScreen = new DialogViewController (context.Root, true);
			ActivateController(detailsScreen);
		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			View titleView = Window.FindViewById(Android.Resource.Id.Title);
			if (titleView != null) {
			  IViewParent parent = titleView.Parent;
			  if (parent != null && (parent is View)) {
			    View parentView = (View)parent;
			    parentView.SetBackgroundColor(Color.Rgb(0x26, 0x75 ,0xFF)); //38, 117 ,255
			  }
			}

			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0) {
				taskItem = Tasky.BL.Managers.TaskItemManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			SetContentView(Resource.Layout.TaskDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.txtName);
			notesTextEdit = FindViewById<EditText>(Resource.Id.txtNotes);
			saveButton = FindViewById<Button>(Resource.Id.btnSave);
			doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
			
			// find all our controls
			cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);
			
			
			// set the cancel delete based on whether or not it's an existing task
			cancelDeleteButton.Text = (taskItem.ID == 0 ? "Cancel" : "Delete");
			
			// name
			nameTextEdit.Text = taskItem.Name;
			
			// notes
			notesTextEdit.Text = taskItem.Notes;

			// done
			doneCheckbox.Checked = taskItem.Done;

			// button clicks 
			cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
			saveButton.Click += (sender, e) => { Save(); };
		}
Пример #4
0
 public TaskViewModel (TaskItem item)
 {
     Update (item);
 }
Пример #5
0
		public TaskDialog (TaskItem task)
		{
			Name = task.Name;
			Notes = task.Notes;
			Done = task.Done;
		}
		public int SaveTask (TaskItem item)
		{
            return repository.SaveTask(item);
		}
		public int SaveTask (TaskItem item)
		{
			return db.SaveItem<TaskItem>(item);
		}