public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            BackgroundView = new UIImageView();

            accept.SetTitleColor(UIColor.White, UIControlState.Normal);
            decline.SetTitleColor(UIColor.White, UIControlState.Normal);

            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);
            };

            if (Theme.IsiOS7)
            {
                priorityBackground.Image = Theme.NumberBoxHollow;
                accept.SetTitleColor(Theme.GreenColor, UIControlState.Normal);
                decline.SetTitleColor(Theme.RedColor, UIControlState.Normal);
                accept.Font           =
                    decline.Font      = Theme.FontOfSize(16);
                startAndEnd.Font      = Theme.BoldFontOfSize(10);
                startAndEnd.TextColor = UIColor.White;

                priority.TextColor =
                    priority.HighlightedTextColor = Theme.LightGrayColor;

                //Status frame
                var frame = status.Frame;
                frame.Width /= 2;
                frame.X     += frame.Width;
                status.Frame = frame;

                //Priority frame
                frame       = priorityBackground.Frame;
                frame.Width = frame.Height;
                priorityBackground.Frame =
                    priority.Frame       = frame;

                //Start/end date
                frame             = startAndEnd.Frame;
                frame.X          += 4;
                startAndEnd.Frame = frame;

                //Additional green rectangle on the right
                statusView = new UIView(new CGRect(Frame.Width - 8, 0, 8, Frame.Height))
                {
                    BackgroundColor  = Theme.YellowColor,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleLeftMargin,
                };
                AddSubview(statusView);

                //Additional box for the start/end date
                frame        = startAndEnd.Frame;
                frame.X     -= 4;
                frame.Y     += 4;
                frame.Width  = 102;
                frame.Height = 16;
                var timeBox = new UIImageView(frame)
                {
                    Image       = Theme.TimeBox,
                    ContentMode = UIViewContentMode.Left,
                };
                ContentView.AddSubview(timeBox);
                ContentView.BringSubviewToFront(startAndEnd);
            }
            else
            {
                priorityBackground.Image = Theme.NumberBox;
                accept.SetBackgroundImage(Theme.Accept, UIControlState.Normal);
                decline.SetBackgroundImage(Theme.Decline, UIControlState.Normal);

                priority.TextColor =
                    priority.HighlightedTextColor = UIColor.White;
            }
        }
        /// <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
            priority.Font = assignment.Priority >= 10 ? Theme.FontOfSize(14f) : Theme.FontOfSize(18f);

            //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;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI we have to setup from code
            tableView.Source     = new TableSource(this);
            timerLabel.TextColor = Theme.LabelColor;

            status.StatusChanged += (sender, e) => SaveAssignment();
            status.Completed     += (sender, e) => {
                menuViewModel.MenuIndex = SectionIndex.Confirmations;
                assignmentViewModel.SelectedAssignment = status.Assignment;

                var method = AssignmentCompleted;
                if (method != null)
                {
                    method(this, EventArgs.Empty);
                }
            };

            if (Theme.IsiOS7)
            {
                //NOTE: tableView.Style is readonly, so we have to do a little work to make our iOS 7 tableView not look like a grouped tableView
                tableView.SeparatorStyle  = UITableViewCellSeparatorStyle.SingleLine;
                tableView.BackgroundColor = Theme.LinenPattern;
                tableView.RowHeight       = 50;

                timerBackground.BackgroundColor = UIColor.White;
                timerLabel.Font = Theme.FontOfSize(24);

                //Move the table around
                var frame = View.Frame;
                frame.X         = 0;
                frame.Y         = -2;
                frame.Height   += 2;
                tableView.Frame = frame;

                //Move the timer
                frame                 = timerBackground.Frame;
                frame.Y              += frame.Height - 80;
                frame.Height          = 80;
                timerBackground.Frame = frame;

                //Move the status dropdown
                frame        = status.Frame;
                frame.X     += 185;
                frame.Y     += 55;
                frame.Width  = 90;
                status.Frame = frame;

                //Move the timer label
                frame            = timerLabel.Frame;
                frame.X         -= 60;
                timerLabel.Frame = frame;

                //Move the record button
                frame        = record.Frame;
                frame.X      = (float)Math.Floor((timerBackground.Frame.Width - frame.Width) / 2);
                record.Frame = frame;

                //Additional green rectangle on the right
                var statusView = new UIView(new RectangleF(timerBackground.Frame.Width - 8, 0, 8, timerBackground.Frame.Height))
                {
                    BackgroundColor  = Theme.GreenColor,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleLeftMargin,
                };
                timerBackground.AddSubview(statusView);
            }
            else
            {
                timerBackground.Image      = Theme.TimerBackground;
                View.BackgroundColor       = Theme.LeftMenuColor;
                timerLabelBackground.Image = Theme.TimerField;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI setup from code
            View.BackgroundColor   = Theme.BackgroundColor;
            photoSheet             = new PhotoAlertSheet();
            photoSheet.DesiredSize = photoSize;
            photoSheet.Callback    = image => {
                photoViewModel.SelectedPhoto.Image = image.ToByteArray();

                var addPhotoController = Storyboard.InstantiateViewController <AddPhotoController>();
                addPhotoController.Dismissed += (sender, e) => ReloadConfirmation();
                PresentViewController(addPhotoController, true, null);
            };
            addPhoto.SetBackgroundImage(Theme.ButtonDark, UIControlState.Normal);
            addPhoto.SetTitleColor(UIColor.White, UIControlState.Normal);

            //Setup our toolbar
            var label = new UILabel(new CGRect(0f, 0f, 120f, 36f))
            {
                Text            = "Confirmations",
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16f),
            };
            var descriptionButton = new UIBarButtonItem(label);

            toolbar.Items = new UIBarButtonItem[] { descriptionButton };

            photoTableView.Source     = new PhotoTableSource(this);
            signatureTableView.Source = new SignatureTableSource(this);

            if (!Theme.IsiOS7)
            {
                return;
            }

            photoTableView.RowHeight  = 64f;
            addPhoto.AutoresizingMask = UIViewAutoresizing.None;
            addPhoto.SetTitleColor(Theme.LabelColor, UIControlState.Normal);
            addPhoto.SetImage(Theme.ImagePlaceholder, UIControlState.Normal);
            addPhoto.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            addPhoto.TitleEdgeInsets     = new UIEdgeInsets(0f, 18f, 0f, 0f);

            var frame = addPhoto.Frame;

            frame.X        = 9f;
            frame.Y       += 10f;
            frame.Height   = 64f;
            frame.Width    = addPhoto.Superview.Frame.Width - 20f;
            addPhoto.Frame = frame;

            frame                    = addPhoto.Superview.Frame;
            frame.Height             = addPhoto.Frame.Bottom;
            addPhoto.Superview.Frame = frame;

            signature.TextColor           =
                photos.TextColor          =
                    requirement.TextColor =
                        note.TextColor    = Theme.LabelColor;

            addPhoto.Font       =
                signature.Font  =
                    photos.Font = Theme.FontOfSize(18f);
            requirement.Font    =
                note.Font       = Theme.FontOfSize(12f);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI that is required to be setup from code
            contact.IconImage        = Theme.IconPhone;
            address.IconImage        = Theme.Map;
            priority.TextColor       = UIColor.White;
            priorityBackground.Image = Theme.NumberBox;

            numberAndDate.TextColor       =
                titleLabel.TextColor      =
                    startAndEnd.TextColor = Theme.LabelColor;

            //Events
            status.StatusChanged += (sender, e) => SaveAssignment();

            status.Completed += (sender, e) =>
            {
                menuViewModel.MenuIndex = SectionIndex.Confirmations;
                assignmentViewModel.SelectedAssignment = status.Assignment;

                var method = Completed;
                if (method != null)
                {
                    Completed(this, EventArgs.Empty);
                }
            };

            //Child controller
            lastChildController   =
                summaryController = ChildViewControllers[0] as SummaryController;

            if (Theme.IsiOS7)
            {
                assignmentBackground.Image = Theme.AssignmentGrey;
                priority.Font         = Theme.FontOfSize(18);
                startAndEnd.Font      = Theme.BoldFontOfSize(10);
                startAndEnd.TextColor = UIColor.White;
                accept.SetTitleColor(Theme.GreenColor, UIControlState.Normal);
                decline.SetTitleColor(Theme.RedColor, UIControlState.Normal);
                accept.Font      =
                    decline.Font = Theme.FontOfSize(16);

                //Status dropdown frame
                var frame = status.Frame;
                frame.Width /= 2;
                frame.X     += frame.Width + 9;
                status.Frame = frame;

                //Priority frames
                frame       = priorityBackground.Frame;
                frame.Width = frame.Height;
                priorityBackground.Frame =
                    priority.Frame       = frame;

                //Start and end dates
                frame             = startAndEnd.Frame;
                frame.X          += 4;
                startAndEnd.Frame = frame;

                //Additional box for the start/end date
                frame        = startAndEnd.Frame;
                frame.X     -= 4;
                frame.Y     += 4;
                frame.Width  = 102;
                frame.Height = 16;
                var timeBox = new UIImageView(frame)
                {
                    Image       = Theme.TimeBox,
                    ContentMode = UIViewContentMode.Left,
                };
                assignmentBackground.AddSubview(timeBox);
                assignmentBackground.BringSubviewToFront(startAndEnd);
            }
            else
            {
                assignmentBackground.Image = Theme.AssignmentActive;
                accept.SetBackgroundImage(Theme.Accept, UIControlState.Normal);
                decline.SetBackgroundImage(Theme.Decline, UIControlState.Normal);
            }
        }