/// <summary>
		/// Sets up the assignment for the cell
		/// </summary>
		public void SetAssignment (AssignmentsController controller, Assignment assignment, NSIndexPath indexPath)
		{
			this.controller = controller;
			this.assignment = assignment;
			this.indexPath = indexPath;

			//Update font size on priority
			if (assignment.Priority >= 10) {
				priority.Font = Theme.FontOfSize (14);
			} else {
				priority.Font = Theme.FontOfSize (18);
			}

			//Now make any changes dependant on the assignment passed in
			((UIImageView)BackgroundView).Image = Theme.AssignmentGrey;
			priority.Text = assignment.Priority.ToString ();
			numberAndDate.Text = string.Format ("#{0} {1}", assignment.JobNumber, assignment.StartDate.Date.ToShortDateString ());
			title.Text = assignment.CompanyName;
			startAndEnd.Text = assignment.FormatStartEndDates ();
			contact.TopLabel.Text = assignment.ContactName;
			contact.BottomLabel.Text = assignment.ContactPhone;
			address.TopLabel.Text = assignment.Address;
			address.BottomLabel.Text = string.Format ("{0}, {1} {2}", assignment.City, assignment.State, assignment.Zip);

			if (assignment.Status == AssignmentStatus.New) {
				if (statusView != null)
					statusView.Hidden = true;
				status.Hidden = true;
				accept.Hidden =
					decline.Hidden = false;

				//Alpha on disabled rows
				if (Theme.IsiOS7) {
					priority.Alpha =
						priorityBackground.Alpha =
						numberAndDate.Alpha =
						title.Alpha =
						contact.Alpha = 
						address.Alpha = 0.5f;
				}

			} else {
				if (statusView != null)
					statusView.Hidden = false;
				status.Hidden = false;
				accept.Hidden =
					decline.Hidden = true;

				//Alpha on disabled rows
				if (Theme.IsiOS7) {
					priority.Alpha =
						priorityBackground.Alpha =
						numberAndDate.Alpha =
						title.Alpha =
						contact.Alpha = 
						address.Alpha = 1;
				}

				status.Assignment = assignment;
			}
		}
        /// <summary>
        /// Sets up the assignment for the cell
        /// </summary>
        public void SetAssignment(AssignmentsController controller, Assignment assignment, NSIndexPath indexPath)
        {
            this.controller = controller;
            this.assignment = assignment;
            this.indexPath  = indexPath;

            //First check things that need to be setup the first time around
            if (!loaded)
            {
                BackgroundView = new UIImageView();

                accept.SetBackgroundImage(Theme.Accept, UIControlState.Normal);
                accept.SetTitleColor(UIColor.White, UIControlState.Normal);

                decline.SetBackgroundImage(Theme.Decline, UIControlState.Normal);
                decline.SetTitleColor(UIColor.White, UIControlState.Normal);
                priority.TextColor =
                    priority.HighlightedTextColor = UIColor.White;
                priorityBackground.Image          = Theme.NumberBox;

                numberAndDate.TextColor       =
                    title.TextColor           =
                        startAndEnd.TextColor =
                            numberAndDate.HighlightedTextColor       =
                                title.HighlightedTextColor           =
                                    startAndEnd.HighlightedTextColor = Theme.LabelColor;

                contact.IconImage     = Theme.IconPhone;
                address.IconImage     = Theme.Map;
                status.StatusChanged += (sender, e) => SaveAssignment();
                status.Completed     += (sender, e) => {
                    var menuViewModel = ServiceContainer.Resolve <MenuViewModel>();
                    menuViewModel.MenuIndex = SectionIndex.Confirmations;
                    assignmentViewModel.SelectedAssignment = status.Assignment;
                    controller.PerformSegue("AssignmentDetails", controller);
                };

                loaded = true;
            }

            //Now make any changes dependant on the assignment passed in
            ((UIImageView)BackgroundView).Image = Theme.AssignmentGrey;
            priority.Text            = assignment.Priority.ToString();
            numberAndDate.Text       = string.Format("#{0} {1}", assignment.JobNumber, assignment.StartDate.Date.ToShortDateString());
            title.Text               = assignment.CompanyName;
            startAndEnd.Text         = string.Format("Start: {0} End: {1}", assignment.StartDate.ToShortTimeString(), assignment.EndDate.ToShortTimeString());
            contact.TopLabel.Text    = assignment.ContactName;
            contact.BottomLabel.Text = assignment.ContactPhone;
            address.TopLabel.Text    = assignment.Address;
            address.BottomLabel.Text = string.Format("{0}, {1} {2}", assignment.City, assignment.State, assignment.Zip);

            if (assignment.Status == AssignmentStatus.New)
            {
                status.Hidden      = true;
                accept.Hidden      =
                    decline.Hidden = false;
            }
            else
            {
                status.Hidden      = false;
                accept.Hidden      =
                    decline.Hidden = true;

                status.Assignment = assignment;
            }
        }
			public TableSource (AssignmentsController controller)
			{
				this.controller = controller;
				assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();
			}
		/// <summary>
		/// Sets up the assignment for the cell
		/// </summary>
		public void SetAssignment (AssignmentsController controller, Assignment assignment, NSIndexPath indexPath)
		{
			this.controller = controller;
			this.assignment = assignment;
			this.indexPath = indexPath;

			//First check things that need to be setup the first time around
			if (!loaded) {
				BackgroundView = new UIImageView ();

				accept.SetBackgroundImage (Theme.Accept, UIControlState.Normal);
				accept.SetTitleColor (UIColor.White, UIControlState.Normal);

				decline.SetBackgroundImage (Theme.Decline, UIControlState.Normal);
				decline.SetTitleColor (UIColor.White, UIControlState.Normal);
				priority.TextColor = 
					priority.HighlightedTextColor = UIColor.White;
				priorityBackground.Image = Theme.NumberBox;

				numberAndDate.TextColor =
					title.TextColor =
					startAndEnd.TextColor = 
					numberAndDate.HighlightedTextColor = 
					title.HighlightedTextColor =
					startAndEnd.HighlightedTextColor = Theme.LabelColor;

				contact.IconImage = Theme.IconPhone;
				address.IconImage = Theme.Map;
				status.StatusChanged += (sender, e) => SaveAssignment ();
				status.Completed += (sender, e) => {
					var menuViewModel = ServiceContainer.Resolve<MenuViewModel>();
					menuViewModel.MenuIndex = SectionIndex.Confirmations;
					assignmentViewModel.SelectedAssignment = status.Assignment;
					controller.PerformSegue ("AssignmentDetails", controller);
				};

				loaded = true;
			}

			//Now make any changes dependant on the assignment passed in
			((UIImageView)BackgroundView).Image = Theme.AssignmentGrey;
			priority.Text = assignment.Priority.ToString ();
			numberAndDate.Text = string.Format ("#{0} {1}", assignment.JobNumber, assignment.StartDate.Date.ToShortDateString ());
			title.Text = assignment.CompanyName;
			startAndEnd.Text = string.Format ("Start: {0} End: {1}", assignment.StartDate.ToShortTimeString (), assignment.EndDate.ToShortTimeString ());
			contact.TopLabel.Text = assignment.ContactName;
			contact.BottomLabel.Text = assignment.ContactPhone;
			address.TopLabel.Text = assignment.Address;
			address.BottomLabel.Text = string.Format ("{0}, {1} {2}", assignment.City, assignment.State, assignment.Zip);

			if (assignment.Status == AssignmentStatus.New) {
				status.Hidden = true;
				accept.Hidden =
					decline.Hidden = false;
			} else {
				status.Hidden = false;
				accept.Hidden =
					decline.Hidden = true;

				status.Assignment = assignment;
			}
		}
 public TableSource(AssignmentsController controller)
 {
     this.controller     = controller;
     assignmentViewModel = ServiceContainer.Resolve <AssignmentViewModel>();
 }
        /// <summary>
        /// Sets up the assignment for the cell
        /// </summary>
        public void SetAssignment(AssignmentsController controller, Assignment assignment, NSIndexPath indexPath)
        {
            this.controller = controller;
            this.assignment = assignment;
            this.indexPath  = indexPath;

            //Update font size on priority
            if (assignment.Priority >= 10)
            {
                priority.Font = Theme.FontOfSize(14);
            }
            else
            {
                priority.Font = Theme.FontOfSize(18);
            }

            //Now make any changes dependant on the assignment passed in
            ((UIImageView)BackgroundView).Image = Theme.AssignmentGrey;
            priority.Text            = assignment.Priority.ToString();
            numberAndDate.Text       = string.Format("#{0} {1}", assignment.JobNumber, assignment.StartDate.Date.ToShortDateString());
            title.Text               = assignment.CompanyName;
            startAndEnd.Text         = assignment.FormatStartEndDates();
            contact.TopLabel.Text    = assignment.ContactName;
            contact.BottomLabel.Text = assignment.ContactPhone;
            address.TopLabel.Text    = assignment.Address;
            address.BottomLabel.Text = string.Format("{0}, {1} {2}", assignment.City, assignment.State, assignment.Zip);

            if (assignment.Status == AssignmentStatus.New)
            {
                if (statusView != null)
                {
                    statusView.Hidden = true;
                }
                status.Hidden      = true;
                accept.Hidden      =
                    decline.Hidden = false;

                //Alpha on disabled rows
                if (Theme.IsiOS7)
                {
                    priority.Alpha =
                        priorityBackground.Alpha      =
                            numberAndDate.Alpha       =
                                title.Alpha           =
                                    contact.Alpha     =
                                        address.Alpha = 0.5f;
                }
            }
            else
            {
                if (statusView != null)
                {
                    statusView.Hidden = false;
                }
                status.Hidden      = false;
                accept.Hidden      =
                    decline.Hidden = true;

                //Alpha on disabled rows
                if (Theme.IsiOS7)
                {
                    priority.Alpha =
                        priorityBackground.Alpha      =
                            numberAndDate.Alpha       =
                                title.Alpha           =
                                    contact.Alpha     =
                                        address.Alpha = 1;
                }

                status.Assignment = assignment;
            }
        }