public override void LoadView () { var view = new UIView ().Apply (Style.Screen); view.Add (nameTextField = new TextField () { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString ( "NewProjectNameHint".Tr (), foregroundColor: Color.Gray ), ShouldReturn = (tf) => tf.ResignFirstResponder (), }.Apply (Style.NewProject.NameField).Apply (BindNameField)); nameTextField.EditingChanged += OnNameFieldEditingChanged; view.Add (clientButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, }.Apply (Style.NewProject.ClientButton).Apply (BindClientButton)); clientButton.TouchUpInside += OnClientButtonTouchUpInside; view.AddConstraints (VerticalLinearLayout (view)); EdgesForExtendedLayout = UIRectEdge.None; View = view; NavigationItem.RightBarButtonItem = new UIBarButtonItem ( "NewProjectAdd".Tr (), UIBarButtonItemStyle.Plain, OnNavigationBarAddClicked) .Apply (Style.NavLabelButton); }
public static void NameField (TextField v) { v.BackgroundColor = Color.White; v.Font = UIFont.FromName ("HelveticaNeue-Light", 17f); v.TextColor = Color.Black; v.TextEdgeInsets = new UIEdgeInsets (0, 15f, 0, 15f); }
public override void LoadView () { var view = new UIView ().Apply (Style.Screen); view.Add (nameTextField = new TextField () { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString ( "NewProjectNameHint".Tr (), foregroundColor: Color.Gray ), ShouldReturn = (tf) => tf.ResignFirstResponder (), } .Apply (Style.NewProject.NameField)); nameTextField.EditingChanged += (sender, e) => ValidateProjectName (); view.Add (clientButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, } .Apply (Style.NewProject.ClientButton).Apply (Style.NewProject.NoClient)); clientButton.SetTitle ("NewProjectClientHint".Tr (), UIControlState.Normal); clientButton.TouchUpInside += OnClientButtonTouchUpInside; view.AddConstraints (VerticalLinearLayout (view)); EdgesForExtendedLayout = UIRectEdge.None; View = view; var addBtn = new UIBarButtonItem ( "NewProjectAdd".Tr (), UIBarButtonItemStyle.Plain, OnSetBtnPressed) .Apply (Style.NavLabelButton).Apply (Style.DisableNavLabelButton); addBtn.Enabled = false; NavigationItem.RightBarButtonItem = addBtn; }
public override void LoadView () { var view = new UIView ().Apply (Style.Screen); view.Add (NameTextField = new TextField { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString ( "NewClientNameHint".Tr (), foregroundColor: Color.Gray ), ShouldReturn = (tf) => tf.ResignFirstResponder (), } .Apply (Style.NewProject.NameField)); NameTextField.EditingChanged += (sender, e) => ValidateClientName (); view.AddConstraints (VerticalLinearLayout (view)); EdgesForExtendedLayout = UIRectEdge.None; View = view; NavigationItem.RightBarButtonItem = new UIBarButtonItem ( "NewClientAdd".Tr (), UIBarButtonItemStyle.Plain, OnNavigationBarAddClicked) .Apply (Style.DisableNavLabelButton); NavigationItem.RightBarButtonItem.Enabled = false; }
public override void LoadView () { durationButton = new UIButton ().Apply (Style.NavTimer.DurationButton); durationButton.SetTitle (DefaultDurationText, UIControlState.Normal); // Dummy content to use for sizing of the label durationButton.SizeToFit (); durationButton.TouchUpInside += OnDurationButtonTouchUpInside; NavigationItem.TitleView = durationButton; var scrollView = new UIScrollView ().Apply (Style.Screen); scrollView.Add (wrapper = new UIView () { TranslatesAutoresizingMaskIntoConstraints = false, }); wrapper.Add (startStopView = new StartStopView { TranslatesAutoresizingMaskIntoConstraints = false, StartTime = ViewModel.StartDate, StopTime = ViewModel.StopDate, }); startStopView.SelectedChanged += OnStartStopViewSelectedChanged; wrapper.Add (datePicker = new UIDatePicker { TranslatesAutoresizingMaskIntoConstraints = false, Hidden = DatePickerHidden, Alpha = 0, } .Apply (Style.EditTimeEntry.DatePicker)); datePicker.ValueChanged += OnDatePickerValueChanged; wrapper.Add (projectButton = new ProjectClientTaskButton { TranslatesAutoresizingMaskIntoConstraints = false, }); projectButton.TouchUpInside += OnProjectButtonTouchUpInside; wrapper.Add (descriptionTextField = new TextField { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString ( "EditEntryDesciptionTimerHint".Tr (), foregroundColor: Color.Gray ), ShouldReturn = tf => tf.ResignFirstResponder (), } .Apply (Style.EditTimeEntry.DescriptionField)); descriptionTextField.ShouldBeginEditing += (s) => { ForceDimissDatePicker(); return true; }; descriptionTextField.ShouldEndEditing += s => { return true; }; wrapper.Add (tagsButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, } .Apply (Style.EditTimeEntry.TagsButton)); tagsButton.TouchUpInside += OnTagsButtonTouchUpInside; wrapper.Add (billableSwitch = new LabelSwitchView () { TranslatesAutoresizingMaskIntoConstraints = false, Text = "EditEntryBillable".Tr (), } .Apply (Style.EditTimeEntry.BillableContainer)); billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel); wrapper.Add (deleteButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, } .Apply (Style.EditTimeEntry.DeleteButton)); deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal); deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside; ResetWrapperConstraints (); scrollView.AddConstraints ( wrapper.AtTopOf (scrollView), wrapper.AtBottomOf (scrollView), wrapper.AtLeftOf (scrollView), wrapper.AtRightOf (scrollView), wrapper.WithSameWidth (scrollView), wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f), null ); View = scrollView; }
public override void LoadView () { var scrollView = new UIScrollView ().Apply (Style.Screen); scrollView.Add (wrapper = new UIView () { TranslatesAutoresizingMaskIntoConstraints = false, }); wrapper.Add (startStopView = new StartStopView () { TranslatesAutoresizingMaskIntoConstraints = false, StartTime = model.StartTime, StopTime = model.StopTime, }.Apply (BindStartStopView)); startStopView.SelectedChanged += OnStartStopViewSelectedChanged; wrapper.Add (datePicker = new UIDatePicker () { TranslatesAutoresizingMaskIntoConstraints = false, Hidden = DatePickerHidden, Alpha = 0, }.Apply (Style.EditTimeEntry.DatePicker).Apply (BindDatePicker)); datePicker.ValueChanged += OnDatePickerValueChanged; wrapper.Add (projectButton = new ProjectClientTaskButton () { TranslatesAutoresizingMaskIntoConstraints = false, }.Apply (BindProjectButton)); projectButton.TouchUpInside += OnProjectButtonTouchUpInside; wrapper.Add (descriptionTextField = new TextField () { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString ( "EditEntryDesciptionTimerHint".Tr (), foregroundColor: Color.Gray ), ShouldReturn = (tf) => tf.ResignFirstResponder (), }.Apply (Style.EditTimeEntry.DescriptionField).Apply (BindDescriptionField)); descriptionTextField.EditingChanged += OnDescriptionFieldEditingChanged; descriptionTextField.EditingDidEnd += (s, e) => CommitDescriptionChanges (); wrapper.Add (tagsButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, }.Apply (Style.EditTimeEntry.TagsButton).Apply (BindTagsButton)); tagsButton.TouchUpInside += OnTagsButtonTouchUpInside; wrapper.Add (billableSwitch = new LabelSwitchView () { TranslatesAutoresizingMaskIntoConstraints = false, Text = "EditEntryBillable".Tr (), }.Apply (Style.EditTimeEntry.BillableContainer).Apply (BindBillableSwitch)); billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel); billableSwitch.Switch.ValueChanged += OnBillableSwitchValueChanged; wrapper.Add (deleteButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, }.Apply (Style.EditTimeEntry.DeleteButton)); deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal); deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside; wrapper.AddConstraints (VerticalLinearLayout (wrapper)); scrollView.AddConstraints ( wrapper.AtTopOf (scrollView), wrapper.AtBottomOf (scrollView), wrapper.AtLeftOf (scrollView), wrapper.AtRightOf (scrollView), wrapper.WithSameWidth (scrollView), wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f), null ); View = scrollView; }
private void BindDescriptionField (TextField v) { if (!descriptionChanging && v.Text != model.Description) { v.Text = model.Description; } }
private void BindNameField (TextField v) { if (v.Text != model.Name) { v.Text = model.Name; } }