Esempio n. 1
0
        public override void LoadView()
        {
            View = new UIView().Apply(Style.Screen);

            Add(new SeparatorView().Apply(Style.Settings.Separator));
            Add(askProjectView = new LabelSwitchView().Apply(Style.Settings.RowBackground));
            askProjectView.Label.Apply(Style.Settings.SettingLabel);
            askProjectView.Label.Text           = "SettingsAskProject".Tr();
            askProjectView.Switch.ValueChanged += OnAskProjectViewValueChanged;

            Add(new SeparatorView().Apply(Style.Settings.Separator));
            Add(new UILabel()
            {
                Text = "SettingsAskProjectDesc".Tr()
            }.Apply(Style.Settings.DescriptionLabel));

            Add(new SeparatorView().Apply(Style.Settings.Separator));
            Add(mobileTagView = new LabelSwitchView().Apply(Style.Settings.RowBackground));
            mobileTagView.Label.Apply(Style.Settings.SettingLabel);
            mobileTagView.Label.Text           = "SettingsMobileTag".Tr();
            mobileTagView.Switch.ValueChanged += OnMobileTagViewValueChanged;

            Add(new SeparatorView().Apply(Style.Settings.Separator));
            Add(new UILabel()
            {
                Text = "SettingsMobileTagDesc".Tr()
            }.Apply(Style.Settings.DescriptionLabel));

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            View.AddConstraints(MakeConstraints(View));

            Rebind();
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 private void BindBillableSwitch(LabelSwitchView v)
 {
     v.Hidden    = model.Workspace == null || !model.Workspace.IsPremium;
     v.Switch.On = model.IsBillable;
 }
Esempio n. 4
0
 private void BindMobileTagView(LabelSwitchView v)
 {
     v.Switch.On = SettingsStore.UseDefaultTag;
 }
Esempio n. 5
0
 private void BindAskProjectView(LabelSwitchView v)
 {
     v.Switch.On = SettingsStore.ChooseProjectForNew;
 }
        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;
        }