Exemplo n.º 1
0
		public void UpdateTask(MobileTask task)
		{
			this.task = task;
			this.Description.Text = task.Description;
			this.DateDue.Text = task.DateDue != null ? task.DateDue.Value.ToString("ddd, M/d/yy h:mm tt") : "No Due Date";
			SetStatusImage(task);
		}
Exemplo n.º 2
0
		private void SetStatusImage(MobileTask task)
		{
			if (task.IsCompleted)
			{
				this.Status.SetImage(new UIImage("IconCompleted"), UIControlState.Normal);
			}
			else if (task.DateDue < DateTime.Now)
			{
				this.Status.SetImage(new UIImage("IconPastDue"), UIControlState.Normal);
			}
			else
			{
				this.Status.SetImage(new UIImage("IconIncomplete"), UIControlState.Normal);
			}
		}
Exemplo n.º 3
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (sender, args) =>
			{
				NavigationController.PopViewController(true);
			}), true);

			NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Save, async (sender, args) =>
			{
				await this.Save();
			}), true);

			//Busy.Hidden = true;
			HasDateDue.ValueChanged += (sender, args) =>
			{
				DateDue.Hidden = !HasDateDue.On;
			};

			if (task != null)
			{
				Description.Text = task.Description;
				Completed.On = task.IsCompleted;
				if (task.DateDue.HasValue)
				{
					HasDateDue.On = true;
					DateDue.Date = (NSDate)task.DateDue.Value;
				}
				else
				{
					HasDateDue.On = false;
					DateDue.Hidden = true;
				}
			}
			else
			{
				task = new MobileTask();
				Completed.On = false;
				HasDateDue.On = false;
				DateDue.Hidden = true;
			}
		}
Exemplo n.º 4
0
		public async Task<MobileTask> UpsertTaskAsync(MobileTask task)
		{
			return await this.Client.InvokeApiAsync<MobileTask, MobileTask>("task", task);
		}
Exemplo n.º 5
0
		public void SetTask(MobileTask task)
		{
			this.task = task;
		}