public void SetUp ()
        {
            ServiceContainer.Register<ISynchronizeInvoke> (() => new Mocks.MockSynchronizeInvoke ());
            ServiceContainer.Register<IAssignmentService> (() => new Mocks.MockAssignmentService ());

            viewModel = new LaborViewModel ();
        }
Example #2
0
 public AddLaborDialog(Activity activity)
     : base(activity)
 {
     this.activity = activity;
     laborViewModel = ServiceContainer.Resolve<LaborViewModel> ();
     laborTypes = new LaborType [] {
         LaborType.Hourly,
         LaborType.OverTime,
         LaborType.HolidayTime,
     };
 }
		public SummaryHistoryActivity ()
		{
			historyViewModel = ServiceContainer.Resolve<HistoryViewModel> ();
			itemViewModel = ServiceContainer.Resolve<ItemViewModel> ();
			laborViewModel = ServiceContainer.Resolve<LaborViewModel> ();
			photoViewModel = ServiceContainer.Resolve<PhotoViewModel> ();
			expenseViewModel = ServiceContainer.Resolve<ExpenseViewModel> ();
			documentViewModel = ServiceContainer.Resolve<DocumentViewModel> ();
			menuViewModel = ServiceContainer.Resolve<MenuViewModel> ();

			assignmentHistory = historyViewModel.SelectedAssignmentHistory;
		}
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);
            var view = inflater.Inflate (Resource.Layout.LaborHoursLayout, null, true);

            laborViewModel = ServiceContainer.Resolve<LaborViewModel> ();

            laborListView = view.FindViewById<ListView> (Resource.Id.laborListViewFragment);

            ReloadLaborHours ();
            laborListView.ItemClick += (sender, e) => {
                var textView = e.View.FindViewById<TextView> (Resource.Id.laborHours);

                var labor = LaborHours.ElementAtOrDefault ((int)textView.Tag);

                laborDialog = new AddLaborDialog (Activity);
                laborDialog.Assignment = Assignment;
                laborDialog.CurrentLabor = labor;
                laborDialog.Show ();
            };
            return view;
        }
		public AddLaborController (IntPtr handle) : base (handle)
		{
			assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();
			laborViewModel = ServiceContainer.Resolve<LaborViewModel>();
		}
			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;
					}
				});
			}
			public TableSource (LaborController controller)
			{
				this.controller = controller;
				laborViewModel = ServiceContainer.Resolve<LaborViewModel>();
				assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();
			}