Ejemplo n.º 1
0
        /// <summary>
        /// Event when the address is clicked
        /// </summary>
        partial void Address()
        {
            var menuViewModel = ServiceContainer.Resolve <MenuViewModel>();

            menuViewModel.MenuIndex = SectionIndex.Maps;
            assignmentViewModel.SelectedAssignment = assignment;
            controller.PerformSegue("AssignmentDetails", controller);
        }
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                var menuViewModel = ServiceContainer.Resolve <MenuViewModel>();

                menuViewModel.MenuIndex = SectionIndex.Summary;
                assignmentViewModel.SelectedAssignment = assignmentViewModel.Assignments[indexPath.Row];
                controller.PerformSegue("AssignmentDetails", controller);
            }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets up the assignment for the cell
        /// </summary>
        public void SetAssignment(AssignmentsController controller, Assignment assignment, NSIndexPath indexPath)
        {
            this.controller = controller;
            this.assignment = assignment;
            this.indexPath  = indexPath;

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

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

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

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

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

                loaded = true;
            }

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

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

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

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

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

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

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

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

				loaded = true;
			}

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

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

				status.Assignment = assignment;
			}
		}
        public 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;
            }
        }