コード例 #1
0
ファイル: TaskCell.cs プロジェクト: brentedwards/MobileTasks
		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);
		}
コード例 #2
0
ファイル: TaskCell.cs プロジェクト: brentedwards/MobileTasks
		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);
			}
		}
コード例 #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;
			}
		}
コード例 #4
0
		public async Task<MobileTask> UpsertTaskAsync(MobileTask task)
		{
			return await this.Client.InvokeApiAsync<MobileTask, MobileTask>("task", task);
		}
コード例 #5
0
		public void SetTask(MobileTask task)
		{
			this.task = task;
		}