Esempio n. 1
0
            public TableSource()
            {
                laborViewModel = ServiceContainer.Resolve <LaborViewModel>();

                typeCell = new UITableViewCell(UITableViewCellStyle.Default, null);
                typeCell.TextLabel.Text = "Type";
                typeCell.AccessoryView  = type = new LaborTypeTextField(new RectangleF(0, 0, 200, 36))
                {
                    TextAlignment     = UITextAlignment.Right,
                    VerticalAlignment = UIControlContentVerticalAlignment.Center,
                    BackgroundColor   = UIColor.Clear,
                };
                typeCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                type.EditingDidEnd     += (sender, e) => {
                    laborViewModel.SelectedLabor.Type = type.LaborType;
                };

                hoursCell = new UITableViewCell(UITableViewCellStyle.Default, null);
                hoursCell.TextLabel.Text = "Hours";
                hoursCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                hoursCell.AccessoryView  = hours = new HoursField(new RectangleF(0, 0, 200, 44));
                hours.ValueChanged      += (sender, e) => laborViewModel.SelectedLabor.Hours = TimeSpan.FromHours(hours.Value);

                descriptionCell = new UITableViewCell(UITableViewCellStyle.Default, null);
                descriptionCell.AccessoryView = description = new PlaceholderTextView(new RectangleF(0, 0, 470, 400))
                {
                    BackgroundColor = UIColor.Clear,
                    TextColor       = Theme.BlueTextColor,
                    Placeholder     = "Please enter notes here",
                };
                descriptionCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                description.SetDidChangeNotification(d => {
                    if (description.Text != description.Placeholder)
                    {
                        laborViewModel.SelectedLabor.Description = d.Text;
                    }
                    else
                    {
                        laborViewModel.SelectedLabor.Description = string.Empty;
                    }
                });
            }
			public TableSource ()
			{
				laborViewModel = ServiceContainer.Resolve<LaborViewModel>();

				typeCell = new UITableViewCell (UITableViewCellStyle.Default, null);
				typeCell.TextLabel.Text = "Type";
				typeCell.AccessoryView = type = new LaborTypeTextField (new CGRect(0, 0, 200, 36))
				{
					TextAlignment = UITextAlignment.Right,
					VerticalAlignment = UIControlContentVerticalAlignment.Center,
					BackgroundColor = UIColor.Clear,
				};
				typeCell.SelectionStyle = UITableViewCellSelectionStyle.None;
				type.EditingDidEnd += (sender, e) => {
					laborViewModel.SelectedLabor.Type = type.LaborType;
				};

				hoursCell = new UITableViewCell (UITableViewCellStyle.Default, null);
				hoursCell.TextLabel.Text = "Hours";
				hoursCell.SelectionStyle = UITableViewCellSelectionStyle.None;
				hoursCell.AccessoryView = hours = new HoursField(new CGRect(0, 0, 200, 44));
				hours.ValueChanged += (sender, e) => laborViewModel.SelectedLabor.Hours = TimeSpan.FromHours (hours.Value);

				descriptionCell = new UITableViewCell (UITableViewCellStyle.Default, null);
				descriptionCell.AccessoryView = description = new PlaceholderTextView(new CGRect(0, 0, Theme.IsiOS7 ? 515 : 470, 400))
				{
					BackgroundColor = UIColor.Clear,
					TextColor = Theme.BlueTextColor,
					Placeholder = "Please enter notes here",
				};
				descriptionCell.SelectionStyle = UITableViewCellSelectionStyle.None;
				description.SetDidChangeNotification (d => {
					if (description.Text != description.Placeholder) {
						laborViewModel.SelectedLabor.Description = d.Text;
					} else {
						laborViewModel.SelectedLabor.Description = string.Empty;
					}
				});
			}