Exemple #1
0
        public TextButton(IntPtr handle) : base(handle)
        {
            icon       = UIButton.FromType(UIButtonType.Custom);
            icon.Frame = new CGRect(Spacing, Spacing, IconBackgroundSize, IconBackgroundSize);
            icon.UserInteractionEnabled = false;
            AddSubview(icon);

            TopLabel = new UILabel {
                BackgroundColor      = UIColor.Clear,
                Font                 = Theme.BoldFontOfSize(11),
                TextColor            = Theme.LabelColor,
                HighlightedTextColor = UIColor.Black,
            };
            AddSubview(TopLabel);

            BottomLabel = new UILabel {
                BackgroundColor      = UIColor.Clear,
                Font                 = Theme.FontOfSize(11),
                TextColor            = Theme.LabelColor,
                HighlightedTextColor = UIColor.Black,
            };
            AddSubview(BottomLabel);

            if (!Theme.IsiOS7)
            {
                icon.SetBackgroundImage(Theme.SmallGreyButton, UIControlState.Normal);
            }
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            if (Theme.IsiOS7)
            {
                BackgroundView = new UIView {
                    BackgroundColor = Theme.BackgroundColor
                };

                addSignature.SetImage(UIImage.FromFile("Images/iOS7/iconsignature.png"), UIControlState.Normal);
                addSignature.SetTitleColor(Theme.LabelColor, UIControlState.Normal);
                addSignature.BackgroundColor = UIColor.White;
                addSignature.Font            = Theme.FontOfSize(18);
                addSignature.ImageEdgeInsets = new UIEdgeInsets(0, -10, 0, 0);

                addSignature.Frame = new RectangleF(PointF.Empty, Frame.Size);
            }
            else
            {
                BackgroundView = new UIImageView {
                    Image = Theme.Inlay
                };

                addSignature.SetTitleColor(UIColor.White, UIControlState.Normal);
            }
        }
        /// <summary>
        /// Sets the active assignment's views
        /// </summary>
        private void LoadActiveAssignment()
        {
            if (assignmentViewModel.ActiveAssignment == null)
            {
                SetActiveAssignmentVisible(false);
            }
            else
            {
                SetActiveAssignmentVisible(true);
                var assignment = assignmentViewModel.ActiveAssignment;

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

                priority.Text            = assignment.Priority.ToString();
                numberAndDate.Text       = string.Format("#{0} {1}", assignment.JobNumber, assignment.StartDate.Date.ToShortDateString());
                titleLabel.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);
                status.Assignment        = assignment;
            }
        }
Exemple #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI setup from code
            description.ShouldReturn = t => {
                Save();
                return(false);
            };
            cancel.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White
            }, UIControlState.Normal);
            cancel.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            var label = new UILabel(new RectangleF(0, 0, 80, 36))
            {
                Text            = "Photo",
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(18),
            };
            var labor = new UIBarButtonItem(label);

            var done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => Save());

            done.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White
            }, UIControlState.Normal);
            done.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            toolbar.Items = new UIBarButtonItem[] {
                cancel,
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                labor,
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                done,
            };

            if (Theme.IsiOS7)
            {
                photo.Frame = photoFrame.Frame;

                date.Font             = Theme.BoldFontOfSize(18);
                time.Font             =
                    deleteButton.Font = Theme.FontOfSize(18);

                deleteButton.SetTitleColor(Theme.RedColor, UIControlState.Normal);
            }
            else
            {
                descriptionBackground.Image = Theme.ModalInlay;
                photoFrame.Image            = Theme.PhotoFrame;

                deleteButton.SetBackgroundImage(Theme.DeleteButton, UIControlState.Normal);
                deleteButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            }
        }
            void SetupCell(UITableViewCell cell, bool start = false, bool end = false)
            {
                if (!Theme.IsiOS7)
                {
                    cell.TextLabel.TextColor            = Theme.LabelColor;
                    cell.TextLabel.HighlightedTextColor = UIColor.White;
                    cell.BackgroundColor = UIColor.Clear;

                    if (start)
                    {
                        cell.BackgroundView = new UIImageView {
                            Image = Theme.LeftListTop
                        };
                        cell.SelectedBackgroundView = new UIImageView {
                            Image = Theme.LeftListTopActive
                        };
                    }
                    else if (end)
                    {
                        cell.BackgroundView = new UIImageView {
                            Image = Theme.LeftListEnd
                        };
                        cell.SelectedBackgroundView = new UIImageView {
                            Image = Theme.LeftListEndActive
                        };
                    }
                    else
                    {
                        cell.BackgroundView = new UIImageView {
                            Image = Theme.LeftListMid
                        };
                        cell.SelectedBackgroundView = new UIImageView {
                            Image = Theme.LeftListMidActive
                        };
                    }

                    cell.ImageView.Image            = Theme.TransparentDot;
                    cell.ImageView.HighlightedImage = Theme.Dot;
                }
                else
                {
                    cell.IndentationLevel = 1;
                    cell.TextLabel.Font   = Theme.FontOfSize(18);
                    cell.TextLabel.HighlightedTextColor = UIColor.White;
                    cell.BackgroundColor = Theme.LinenPattern;
                    cell.BackgroundView  = new UIView {
                        BackgroundColor = Theme.LinenPattern
                    };
                    cell.SelectedBackgroundView = new UIView {
                        BackgroundColor = Theme.DarkGrayColor
                    };
                }

                if (!cells.Contains(cell))
                {
                    cells.Add(cell);
                }
            }
Exemple #6
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            label.TextColor = Theme.LabelColor;

            if (Theme.IsiOS7)
            {
                label.Font = Theme.FontOfSize(18);
            }
        }
Exemple #7
0
        /// <summary>
        /// Sets up the UI for the assignment
        /// </summary>
        public void UpdateAssignment()
        {
            var assignment = assignmentViewModel.SelectedAssignment;

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

                var splitController = ParentViewController as SplitController;
                if (splitController != null)
                {
                    splitController.NavigationItem.Title = assignment.JobNumberFormatted + " " + assignment.CompanyName;
                }
                priority.Text            = assignment.Priority.ToString();
                numberAndDate.Text       = string.Format("{0} {1}", assignment.JobNumberFormatted, assignment.StartDate.Date.ToShortDateString());
                titleLabel.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);
                status.Assignment        = assignment;
                status.Enabled           = assignment.Status != AssignmentStatus.Complete && !assignment.IsHistory;

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

                var confirmationController = ChildViewControllers[0] as ConfirmationController;
                if (confirmationController != null)
                {
                    confirmationController.ReloadConfirmation();
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Sets the active assignment's views
        /// </summary>
        void LoadActiveAssignment()
        {
            var assignment = assignmentViewModel.ActiveAssignment;

            //Update font size on priority
            priority.Font = Theme.FontOfSize(assignment.Priority >= 10 ? 14f : 18f);

            priority.Text            = assignment.Priority.ToString();
            numberAndDate.Text       = string.Format("#{0} {1}", assignment.JobNumber, assignment.StartDate.Date.ToShortDateString());
            titleLabel.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);
            status.Assignment        = assignment;
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            if (Theme.IsiOS7)
            {
                SelectionStyle         = UITableViewCellSelectionStyle.Blue;
                SelectedBackgroundView = new UIView {
                    BackgroundColor = UIColor.Clear
                };
                BackgroundView = new UIView {
                    BackgroundColor = Theme.BackgroundColor
                };

                date.TextColor            =
                    description.TextColor = Theme.LabelColor;
                date.Font        = Theme.FontOfSize(18);
                description.Font = Theme.FontOfSize(14);

                //Change the image frame
                var frame = photoFrame.Frame;
                frame.Y      = 0;
                frame.Height = Frame.Height;
                frame.Width -= 12;
                photo.Frame  = frame;

                //Changes to widths on text
                frame        = date.Frame;
                frame.Width -= 15;
                date.Frame   = frame;

                frame             = description.Frame;
                frame.Width      -= 15;
                description.Frame = frame;
            }
            else
            {
                BackgroundView = new UIImageView {
                    Image = Theme.Inlay
                };
                photoFrame.Image = Theme.PhotoFrame;
            }
        }
Exemple #10
0
        public StatusButton(IntPtr handle) : base(handle)
        {
            AddSubview(statusImage = new UIImageView(new CGRect(12, (Frame.Height - 16) / 2, 16, 16)));

            SetTitleColor(Theme.LabelColor, UIControlState.Normal);
            SetBackgroundImage(Theme.DropDown, UIControlState.Normal);

            TouchUpInside += OnTouchUpInside;

            if (Theme.IsiOS7)
            {
                ContentEdgeInsets   = new UIEdgeInsets();
                HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
                Font = Theme.FontOfSize(16);
            }
            else
            {
                ContentEdgeInsets = new UIEdgeInsets(0, 38, 0, 0);
            }
        }
Exemple #11
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            completeButton.SetBackgroundImage(Theme.Complete, UIControlState.Normal);
            completeButton.SetBackgroundImage(Theme.CompleteInactive, UIControlState.Disabled);
            completeButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            completeButton.SetTitle("Complete", UIControlState.Normal);
            completeButton.SetTitle("Completed", UIControlState.Disabled);

            if (Theme.IsiOS7)
            {
                BackgroundView = new UIView {
                    BackgroundColor = Theme.BackgroundColor
                };
                completeButton.Font = Theme.FontOfSize(18);
            }
            else
            {
                BackgroundView = new UIImageView {
                    Image = Theme.Inlay
                };
            }
        }
Exemple #12
0
        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);
            }
        }
        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)
            {
                timerBackground.Image      = Theme.TimerBackground;
                View.BackgroundColor       = Theme.LeftMenuColor;
                timerLabelBackground.Image = Theme.TimerField;
                return;
            }

            //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       = 50f;

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

            //Move the table around
            var frame = View.Frame;

            frame.X         = 0f;
            frame.Y         = -2f;
            frame.Height   += 2f;
            tableView.Frame = frame;

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

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

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

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

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

            timerBackground.AddSubview(statusView);
        }
        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 RectangleF(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
            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;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Setup mapView
            mapView.Delegate = new MapViewDelegate(this);

            //Setup other UI
            assignmentButton.SetBackgroundImage(Theme.AssignmentActive, UIControlState.Normal);
            contact.IconImage        = Theme.IconPhone;
            address.IconImage        = Theme.Map;
            priority.TextColor       = UIColor.White;
            priorityBackground.Image = Theme.NumberBox;
            record.SetImage(assignmentViewModel.Recording ? Theme.RecordActive : Theme.Record, UIControlState.Normal);

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

            status.StatusChanged += (sender, e) => {
                assignmentViewModel
                .SaveAssignmentAsync(assignmentViewModel.ActiveAssignment)
                .ContinueWith(_ => BeginInvokeOnMainThread(LoadActiveAssignment));
            };

            //Start the active assignment out as not visible
            SetActiveAssignmentVisible(false, false);

            if (Theme.IsiOS7)
            {
                timerLabel.Font       = Theme.FontOfSize(16);
                priority.Font         = Theme.FontOfSize(18);
                startAndEnd.Font      = Theme.BoldFontOfSize(10);
                startAndEnd.TextColor = UIColor.White;

                //Shadow frame
                var frame = toolbarShadow.Frame;
                frame.Height        = 1;
                toolbarShadow.Frame = frame;
                toolbarShadow.Image = UIColor.LightGray.ToImage();

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

                const float offset = 100;

                //Timer frame
                frame            = timerLabel.Frame;
                frame.X         += offset + 35;
                timerLabel.Frame = frame;

                //Record (play/pause) button frame
                frame        = record.Frame;
                frame.X     += offset;
                record.Frame = frame;

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

                //Info frames
                frame               = numberAndDate.Frame;
                frame.X            -= 10;
                numberAndDate.Frame = frame;

                frame            = titleLabel.Frame;
                frame.X         -= 10;
                titleLabel.Frame = frame;

                frame             = startAndEnd.Frame;
                frame.X          -= 6;
                startAndEnd.Frame = frame;

                //Address frame
                frame         = address.Frame;
                frame.X      -= 10;
                address.Frame = frame;

                //Contact frame
                frame         = contact.Frame;
                frame.X      -= 10;
                contact.Frame = frame;

                //Assignment
                frame                  = activeAssignment.Frame;
                frame.Height          -= 5;
                activeAssignment.Frame = frame;

                //Additional green rectangle on the right
                var statusView = new UIView(new RectangleF(activeAssignment.Frame.Width - 8, 0, 8, activeAssignment.Frame.Height))
                {
                    BackgroundColor  = Theme.GreenColor,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleLeftMargin,
                };
                activeAssignment.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,
                };
                activeAssignment.AddSubview(timeBox);
                activeAssignment.BringSubviewToFront(startAndEnd);
            }
            else
            {
                assignmentButton.SetBackgroundImage(Theme.AssignmentActiveBlue, UIControlState.Highlighted);
                toolbarShadow.Image        = Theme.ToolbarShadow;
                timerBackgroundImage.Image = Theme.TimerField;
            }
        }
Exemple #17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI that has to be setup from code
            View.BackgroundColor           = Theme.BackgroundColor;
            description.TextColor          =
                descriptionTitle.TextColor = Theme.LabelColor;

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

            descriptionButton = new UIBarButtonItem(label);

            viewHistory = new UIBarButtonItem("View History", UIBarButtonItemStyle.Bordered, (sender, e) => {
                var menuViewModel       = ServiceContainer.Resolve <MenuViewModel>();
                menuViewModel.MenuIndex = SectionIndex.History;
            });

            viewHistory.SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White
            }, UIControlState.Normal);
            viewHistory.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            if (!Theme.IsiOS7)
            {
                descriptionBackground.Image = Theme.RowEnd;

                itemsBackground.Image            =
                    hoursBackground.Image        =
                        expensesBackground.Image = Theme.Inlay;

                itemsLabel.TextColor                    =
                    items.TextColor                     =
                        hoursLabel.TextColor            =
                            hours.TextColor             =
                                expensesLabel.TextColor =
                                    expenses.TextColor  = UIColor.White;
                return;
            }

            descriptionBackground.BackgroundColor = UIColor.White;

            itemsLabel.Font                    =
                items.Font                     =
                    hoursLabel.Font            =
                        hours.Font             =
                            expensesLabel.Font =
                                expenses.Font  = Theme.FontOfSize(18f);

            itemsLabel.TextColor                    =
                items.TextColor                     =
                    hoursLabel.TextColor            =
                        hours.TextColor             =
                            expensesLabel.TextColor =
                                expenses.TextColor  = Theme.LabelColor;

            itemsBackground.BackgroundColor            =
                hoursBackground.BackgroundColor        =
                    expensesBackground.BackgroundColor = Theme.LightGrayColor;

            //Move backgrounds around to appear as lines
            var frame = itemsBackground.Frame;

            frame.X               = 0f;
            frame.Y              += frame.Height - 1f;
            frame.Height          = 1f;
            frame.Width           = View.Frame.Width;
            itemsBackground.Frame = frame;

            frame                 = hoursBackground.Frame;
            frame.X               = 0f;
            frame.Y              += frame.Height - 1f;
            frame.Height          = 1f;
            frame.Width           = View.Frame.Width;
            hoursBackground.Frame = frame;

            frame                    = expensesBackground.Frame;
            frame.X                  = 0f;
            frame.Y                 += frame.Height - 1f;
            frame.Height             = 1f;
            frame.Width              = View.Frame.Width;
            expensesBackground.Frame = frame;
        }
Exemple #18
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Set up any properties on views that must be done from code
            View.BackgroundColor  = Theme.LinenPattern;
            box.Image             = Theme.LoginBox;
            companyName.TextColor = Theme.LabelColor;
            questionMark.SetImage(Theme.QuestionMark, UIControlState.Normal);
            logo.Image = Theme.Logo;
            login.SetBackgroundImage(Theme.LoginButton, UIControlState.Normal);

            //Text Fields
            //I used LeftView as a quick way to add padding to a "plain" styled UITextField

            username.LeftViewMode = UITextFieldViewMode.Always;
            username.TextColor    = Theme.LabelColor;
            username.SetDidChangeNotification(text => loginViewModel.Username = text.Text);
            username.ShouldReturn = _ => {
                password.BecomeFirstResponder();
                return(false);
            };

            password.LeftViewMode = UITextFieldViewMode.Always;
            password.TextColor    = Theme.LabelColor;
            password.SetDidChangeNotification(text => loginViewModel.Password = text.Text);
            password.ShouldReturn = _ => {
                if (loginViewModel.IsValid)
                {
                    Login();
                }
                return(false);
            };

            if (Theme.IsiOS7)
            {
                companyName.Hidden    = true;
                username.LeftView     = new UIView(new RectangleF(0, 0, 20, 20));
                password.LeftView     = new UIView(new RectangleF(0, 0, 20, 20));
                login.Font            =
                    username.Font     =
                        password.Font = Theme.FontOfSize(18);
                hexagons.Image        = UIImage.FromFile("Images/iOS7/hexagons.png");

                //Add light gray lines
                var view = new UIView(new RectangleF(0, 0, container.Frame.Width, 1))
                {
                    BackgroundColor = Theme.LightGrayColor,
                };
                username.AddSubview(view);

                view = new UIView(new RectangleF(0, 0, container.Frame.Width, 1))
                {
                    BackgroundColor = Theme.LightGrayColor,
                };
                password.AddSubview(view);

                //Resize the container
                var frame = container.Frame;
                frame.Width     = 400;
                frame.Height    = 300;
                frame.X         = (View.Frame.Width - frame.Width) / 2;
                frame.Y         = (View.Frame.Height - frame.Height) / 2;
                container.Frame = frame;

                //Move up the logo
                frame        = logo.Frame;
                frame.Y     -= 10;
                frame.Width  = 172;
                frame.Height = 48;
                logo.Frame   = frame;

                //Move the login button
                frame       = login.Frame;
                frame.X     = 0;
                frame.Y     = container.Frame.Height - frame.Height;
                frame.Width = container.Frame.Width;
                login.Frame = frame;

                //Move the indicator
                frame           = indicator.Frame;
                frame.Y         = (container.Frame.Height - frame.Height) / 2;
                indicator.Frame = frame;

                //Move the username and password
                frame          = username.Frame;
                frame.X        = 0;
                frame.Y       -= 60;
                frame.Width    = container.Frame.Width;
                username.Frame = frame;

                frame          = password.Frame;
                frame.X        = 0;
                frame.Y       -= 80;
                frame.Width    = container.Frame.Width;
                password.Frame = frame;
            }
            else
            {
                username.Background     =
                    password.Background = Theme.LoginTextField;
                username.LeftView       = new UIView(new RectangleF(0, 0, 10, 10));
                password.LeftView       = new UIView(new RectangleF(0, 0, 10, 10));
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Setup UI that is required from code
            tableView.Source = new TableSource(this);
            assignmentButton.SetBackgroundImage(Theme.AssignmentActive, UIControlState.Normal);
            contact.IconImage        = Theme.IconPhone;
            address.IconImage        = Theme.Map;
            priority.TextColor       = UIColor.White;
            priorityBackground.Image = Theme.NumberBox;
            record.ContentMode       = UIViewContentMode.Center;
            record.SetImage(assignmentViewModel.Recording ? Theme.RecordActive : Theme.Record, UIControlState.Normal);

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

            status.StatusChanged += (sender, e) => {
                assignmentViewModel
                .SaveAssignmentAsync(assignmentViewModel.ActiveAssignment)
                .ContinueWith(_ => BeginInvokeOnMainThread(ReloadAssignments));
            };
            status.Completed += (sender, e) => {
                var menuViewModel = ServiceContainer.Resolve <MenuViewModel>();
                menuViewModel.MenuIndex = SectionIndex.Confirmations;
                assignmentViewModel.SelectedAssignment = status.Assignment;
                PerformSegue("AssignmentDetails", this);
            };

            //Start the active assignment out as not visible
            SetActiveAssignmentVisible(false, false);

            //Load the current timer status
            record.Enabled = false;
            assignmentViewModel.LoadTimerEntryAsync().ContinueWith(_ => {
                BeginInvokeOnMainThread(() => {
                    record.Enabled = true;
                    if (assignmentViewModel.Recording)
                    {
                        record.SetImage(Theme.RecordActive, UIControlState.Normal);
                    }
                    else
                    {
                        record.SetImage(Theme.Record, UIControlState.Normal);
                    }
                });
            });

            if (Theme.IsiOS7)
            {
                tableView.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
                timerLabel.Font          = Theme.FontOfSize(16);
                startAndEnd.Font         = Theme.BoldFontOfSize(10);
                startAndEnd.TextColor    = UIColor.White;

                //Shadow frame
                var frame = toolbarShadow.Frame;
                frame.Height        = 1;
                toolbarShadow.Frame = frame;
                toolbarShadow.Image = UIColor.LightGray.ToImage();

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

                const float offset = 100;

                //Timer frame
                frame            = timerLabel.Frame;
                frame.X         += offset + 35;
                timerLabel.Frame = frame;

                //Record (play/pause) button frame
                frame        = record.Frame;
                frame.X     += offset;
                record.Frame = frame;

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

                //Info frames
                frame               = numberAndDate.Frame;
                frame.X            -= 10;
                numberAndDate.Frame = frame;

                frame            = titleLabel.Frame;
                frame.X         -= 10;
                titleLabel.Frame = frame;

                frame             = startAndEnd.Frame;
                frame.X          -= 6;
                startAndEnd.Frame = frame;

                //Address frame
                frame         = address.Frame;
                frame.X      -= 10;
                address.Frame = frame;

                //Contact frame
                frame         = contact.Frame;
                frame.X      -= 10;
                contact.Frame = frame;

                //Additional green rectangle on the right
                var statusView = new UIView(new RectangleF(activeAssignment.Frame.Width - 8, 0, 8, activeAssignment.Frame.Height))
                {
                    BackgroundColor  = Theme.GreenColor,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleLeftMargin,
                };
                activeAssignment.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,
                };
                activeAssignment.AddSubview(timeBox);
                activeAssignment.BringSubviewToFront(startAndEnd);
            }
            else
            {
                tableView.BackgroundColor = Theme.BackgroundColor;
                assignmentButton.SetBackgroundImage(Theme.AssignmentActiveBlue, UIControlState.Highlighted);
                toolbarShadow.Image        = Theme.ToolbarShadow;
                timerBackgroundImage.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 RectangleF(0, 0, 120, 36))
            {
                Text            = "Confirmations",
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16),
            };
            var descriptionButton = new UIBarButtonItem(label);

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

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

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

                var frame = addPhoto.Frame;
                frame.X        = 9;
                frame.Y       += 10;
                frame.Height   = 64;
                frame.Width    = addPhoto.Superview.Frame.Width - 20;
                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(18);
                requirement.Font    =
                    note.Font       = Theme.FontOfSize(12);
            }
        }