コード例 #1
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			SaveButton.TouchUpInside += (sender, e) => {
				// retrieve data from UIneed 
				currentTask.Title = TitleText.Text;
				currentTask.Done = DoneSwitch.On;

				var vm = new TaskViewModel();
				currentTask.Id = vm.Save (currentTask); // unnecessary

				NavigationController.PopToRootViewController (true);
			};

			CancelButton.TouchUpInside += (sender, e) => {
				NavigationController.PopToRootViewController (true);
			};
		}
コード例 #2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView(Resource.Layout.TaskList);

			addButton = FindViewById<Button> (Resource.Id.AddButton);
			addButton.Click += (sender, e) => {
				StartActivity(typeof(TaskView));
			};

			taskList = FindViewById<ListView> (Resource.Id.TaskList);
			taskList.ItemClick += (sender, e) => {
				var taskDetails = new Intent (this, typeof (TaskView));
				taskDetails.PutExtra ("TaskId", tasks[e.Position].Id);
				StartActivity (taskDetails);
			};

			vm = new TaskViewModel ();
		}
コード例 #3
0
		protected override void OnCreate (Android.OS.Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			vm = new TaskViewModel ();

			int taskID = Intent.GetIntExtra("TaskId", 0);
			if (taskID > 0) {
				currentTask = vm.Get (taskID);
			} else {
				currentTask = new Task ();
			}


			SetContentView(Resource.Layout.TaskView);

			titleText = FindViewById<EditText>(Resource.Id.TitleText);
			doneCheckBox = FindViewById<CheckBox>(Resource.Id.DoneCheckBox);

			titleText.Text = currentTask.Title;
			doneCheckBox.Checked = currentTask.Done;

			saveButton = FindViewById<Button>(Resource.Id.SaveButton);

			saveButton.Click += (sender, e) => {
				currentTask.Title = titleText.Text;
				currentTask.Done = doneCheckBox.Checked;

				currentTask.Id = vm.Save (currentTask); // unnecessary

				Finish();
			};


			var cancelButton = FindViewById<Button> (Resource.Id.CancelButton);
			cancelButton.Click += (sender, e) => {
				Finish();
			};
		}
コード例 #4
0
		public TaskListViewController (IntPtr handle) : base (handle)
		{
			vm = new TaskViewModel ();
		}
コード例 #5
0
 public TaskListViewController(IntPtr handle) : base(handle)
 {
     vm = new TaskViewModel();
 }