Esempio n. 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI to setup from code
            title = new UILabel(new RectangleF(0, 0, 160, 36))
            {
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16),
            };
            var titleButton = new UIBarButtonItem(title);

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

            tableView.Source = new TableSource(documentViewModel);

            if (Theme.IsiOS7)
            {
                tableView.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
                tableView.SeparatorInset = new UIEdgeInsets(0, 40, 0, 0);
            }
            else
            {
                View.BackgroundColor = Theme.BackgroundColor;
            }
        }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI to setup from code
            title = new UILabel(new CGRect(0f, 0f, 160f, 36f))
            {
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16f),
            };
            var titleButton = new UIBarButtonItem(title);

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

            tableView.Source =
                tableSource  = new TableSource(this);

            if (Theme.IsiOS7)
            {
                tableView.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
            }
            else
            {
                View.BackgroundColor = Theme.BackgroundColor;
            }
        }
Esempio n. 3
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 ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI that must be setup from code
            View.BackgroundColor = Theme.BackgroundColor;
            title = new UILabel(new RectangleF(0, 0, 100, 36))
            {
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16),
                Text            = "Items",
            };
            titleButton   = new UIBarButtonItem(title);
            toolbar.Items = new UIBarButtonItem[] { titleButton };

            var textAttributes = new UITextAttributes {
                TextColor = UIColor.White
            };

            edit = new UIBarButtonItem("Edit", UIBarButtonItemStyle.Bordered, delegate {
                edit.Title = tableView.Editing ? "Edit" : "Done";
                tableView.SetEditing(!tableView.Editing, true);
            });
            edit.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
            edit.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            addItem = new UIBarButtonItem("Add Item", UIBarButtonItemStyle.Bordered, OnAddItem);
            addItem.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
            addItem.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            tableView.Source = new TableSource(this);
        }
Esempio n. 5
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new CGRect (0f, 0f, 80f, 36f)) { 
				Text = "Labor",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18f),
			};
			labor = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				laborViewModel
					.SaveLaborAsync (assignmentViewModel.SelectedAssignment, laborViewModel.SelectedLabor)
					.ContinueWith (_ => BeginInvokeOnMainThread (() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			space1 = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);

			tableView.Source = 
				tableSource = new TableSource ();
		}
Esempio n. 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI setup from code
            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            = "Items",
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(18),
            };
            var items = new UIBarButtonItem(label);

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

            tableView.Source = new TableSource(this);
            var searchDataSource = new SearchSource(this);

            SearchDisplayController.SearchResultsSource = searchDataSource;
            SearchDisplayController.Delegate            = new SearchDisplay(tableView, searchDataSource);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
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);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI to setup from code
            title = new UILabel(new RectangleF(0, 0, 160, 36))
            {
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16),
                Text            = "Labor Hours",
            };
            titleButton   = new UIBarButtonItem(title);
            toolbar.Items = new UIBarButtonItem[] { titleButton };

            var textAttributes = new UITextAttributes()
            {
                TextColor = UIColor.White
            };

            edit = new UIBarButtonItem("Edit", UIBarButtonItemStyle.Bordered, delegate {
                edit.Title = tableView.Editing ? "Edit" : "Done";
                tableView.SetEditing(!tableView.Editing, true);
            });
            edit.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
            edit.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            addItem = Theme.IsiOS7 ?
                      new UIBarButtonItem(UIBarButtonSystemItem.Add, OnAddLabor) :
                      new UIBarButtonItem("Add Labor", UIBarButtonItemStyle.Bordered, OnAddLabor);
            addItem.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
            addItem.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            tableView.Source = new TableSource(this);

            if (Theme.IsiOS7)
            {
                tableView.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
                addItem.TintColor        = UIColor.White;
            }
            else
            {
                View.BackgroundColor = Theme.BackgroundColor;
            }
        }
Esempio n. 10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI setup from code
            cancel.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White
            }, UIControlState.Normal);

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

            expense = new UIBarButtonItem(label);

            done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
                //Save the expense
                var task = expenseViewModel.SaveExpenseAsync(assignmentViewModel.SelectedAssignment, expenseViewModel.SelectedExpense);
                //Save the photo if we need to
                if (expenseViewModel.Photo != null)
                {
                    task = task
                           .ContinueWith(_ => expenseViewModel.Photo.ExpenseId = expenseViewModel.SelectedExpense.Id)
                           .ContinueWith(expenseViewModel.SavePhotoAsync());
                }
                //Dismiss the controller after the other tasks
                task.ContinueWith(_ => BeginInvokeOnMainThread(() => DismissViewController(true, null)));
            });
            done.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White
            }, UIControlState.Normal);
            done.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
            space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            tableView.Source =
                tableSource  = new TableSource();
        }
Esempio n. 11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI to setup from code
            View.BackgroundColor = Theme.BackgroundColor;
            title = new UILabel(new RectangleF(0, 0, 160, 36))
            {
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16),
            };
            var titleButton = new UIBarButtonItem(title);

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

            tableView.Source = new TableSource(documentViewModel);
        }
Esempio n. 12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI that has to be setup from code
            View.BackgroundColor             = Theme.BackgroundColor;
            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;
            description.TextColor                   =
                descriptionTitle.TextColor          = Theme.LabelColor;

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

            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);
        }
Esempio n. 13
0
        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;
            }
        }
        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;
            }
        }
Esempio n. 15
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;
        }
        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;
            }
        }
Esempio n. 17
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 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);
            }
        }