Esempio n. 1
0
		public static Task FromParseObject (ParseObject po)
		{
			var t = new Task();
			t.Id = po.ObjectId;
			t.Title = Convert.ToString(po["Title"]);
            t.Description = Convert.ToString (po["Description"]);
            t.IsDone = Convert.ToBoolean (po["IsDone"]);
			return t;
		}
Esempio n. 2
0
 public int SaveItem(Task item)
 {
     lock (locker) {
         if (item.Id > 0) {
             Update (item);
             return item.Id;
         } else {
             return Insert (item);
         }
     }
 }
Esempio n. 3
0
		protected async override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

            #region color the titlebar
            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
			  }
            }
            #endregion

            // set our layout to be the details screen
            SetContentView(Resource.Layout.TaskDetails);

            taskID = Intent.GetStringExtra ("TaskID");

			// find all our controls
			nameTextEdit = FindViewById<EditText>(Resource.Id.txtName);
			notesTextEdit = FindViewById<EditText>(Resource.Id.txtNotes);
			saveButton = FindViewById<Button>(Resource.Id.btnSave);
			doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
			deleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);
			
			// set the cancel delete based on whether or not it's an existing task
			deleteButton.Enabled = false;
			saveButton.Text = "waiting...";
			saveButton.Enabled = false;

			// button clicks 
			deleteButton.Click += Delete;
			saveButton.Click += Save;

			if (!String.IsNullOrEmpty(taskID)) 
				task = await Populate();
			else
				task = new Task();

			// name
			nameTextEdit.Text = task.Title;
			
			// notes
			notesTextEdit.Text = task.Description;

			doneCheckbox.Checked = task.IsDone;

			saveButton.Text = "Save";
			saveButton.Enabled = true;
			deleteButton.Enabled = true;
		}
Esempio n. 4
0
		async System.Threading.Tasks.Task<Parse.Task> Populate () 
		{
			Task ta = new Task();

			try {
				var query = ParseObject.GetQuery("Task").WhereEqualTo("objectId", taskID);
				var t = await query.FirstAsync();
				ta = Task.FromParseObject (t);
			} catch (ParseException pe) {
				Console.WriteLine ("Parse Exception:{0}", pe.Message);
			}
			return ta;
		}
Esempio n. 5
0
		public override async void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s,e) => {
				var task = new Task() {Title="<new task>"};

				var ts = new TaskScreen (task, this);
				NavigationController.PushViewController (ts, true);
			});
			NavigationItem.RightBarButtonItem = addButton;

			await ReloadAsync();
		}
Esempio n. 6
0
		async System.Threading.Tasks.Task Populate () 
		{
			Title = "loading...";
			Task ta = new Task();

			try {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

				var query = ParseObject.GetQuery("Task").WhereEqualTo("objectId", task.Id);
				var t = await query.FirstAsync();
				ta = Task.FromParseObject (t);
			} catch (ParseException pe) {
				Console.WriteLine ("Parse Exception:{0}", pe.Message);
			} finally {
				Title = ""; // clear "loading..." message
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
			}

			// Populate UI controls
			titleText.Text = ta.Title??"";
			descriptionText.Text = ta.Description??"";
			doneSwitch.On = ta.IsDone;			

			saveButton.Enabled = true;
			doneSwitch.Enabled = true;
			deleteButton.Enabled = true;
		}
Esempio n. 7
0
		public TaskScreen (Task t, TaskListScreen caller) {
			task = t;
			screen = caller;
		}