private void prepareViews()
        {
            if (TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Regular)
            {
                PreferredContentSize = new CGSize(0, desiredIpadHeight);
            }

            //This is needed for the ImageView.TintColor bindings to work
            foreach (var button in getButtons())
            {
                button.SetImage(
                    button.ImageForState(UIControlState.Normal)
                    .ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate),
                    UIControlState.Normal
                    );
                button.TintColor = Colors.StartTimeEntry.InactiveButton.ToNativeColor();
            }

            TimeInput.TintColor = Colors.StartTimeEntry.Cursor.ToNativeColor();

            DescriptionTextView.TintColor = Colors.StartTimeEntry.Cursor.ToNativeColor();
            DescriptionTextView.BecomeFirstResponder();

            Placeholder.ConfigureWith(DescriptionTextView);
            Placeholder.Text = Resources.StartTimeEntryPlaceholder;

            prepareTimeViews();
        }
예제 #2
0
        void ReleaseDesignerOutlets()
        {
            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (NextLabel != null)
            {
                NextLabel.Dispose();
                NextLabel = null;
            }

            if (SecretFileNameLabel != null)
            {
                SecretFileNameLabel.Dispose();
                SecretFileNameLabel = null;
            }
        }
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            if (TimeInput.IsEditing)
            {
                TimeInput.EndEditing(true);
                DescriptionTextView.BecomeFirstResponder();
            }
        }
        private void onTextFieldInfo(TextFieldInfo textFieldInfo)
        {
            isUpdatingDescriptionField          = true;
            var(attributedText, cursorPosition) = textFieldInfo.AsAttributedTextAndCursorPosition();

            DescriptionTextView.AttributedText = attributedText;

            var positionToSet = DescriptionTextView.GetPosition(DescriptionTextView.BeginningOfDocument, cursorPosition);

            DescriptionTextView.SelectedTextRange = DescriptionTextView.GetTextRange(positionToSet, positionToSet);
            updatePlaceholder();
            isUpdatingDescriptionField = false;
        }
예제 #5
0
        private bool validateForm()
        {
            Gdk.Color redColor = new Gdk.Color();
            Gdk.Color.Parse("red", ref redColor);

            Gdk.Color whiteColor = new Gdk.Color();
            Gdk.Color.Parse("white", ref whiteColor);

            if (String.IsNullOrEmpty(VehicleOwnerEntry.Text))
            {
                VehicleOwnerEntry.ModifyBase(StateType.Normal, redColor);
                return(false);
            }
            else
            {
                VehicleOwnerEntry.ModifyBase(StateType.Normal, whiteColor);
            }

            if (String.IsNullOrEmpty(RegistrationEntry.Text))
            {
                RegistrationEntry.ModifyBase(StateType.Normal, redColor);
                return(false);
            }
            else
            {
                RegistrationEntry.ModifyBase(StateType.Normal, whiteColor);
            }

            if (String.IsNullOrEmpty(VehicleTypeEntry.Text))
            {
                VehicleTypeEntry.ModifyBase(StateType.Normal, redColor);
                return(false);
            }
            else
            {
                VehicleTypeEntry.ModifyBase(StateType.Normal, whiteColor);
            }


            if (String.IsNullOrEmpty(DescriptionTextView.Buffer.Text))
            {
                DescriptionTextView.ModifyBase(StateType.Normal, redColor);
                return(false);
            }
            else
            {
                DescriptionTextView.ModifyBase(StateType.Normal, whiteColor);
            }

            return(true);
        }
        void ReleaseDesignerOutlets()
        {
            if (CityLabel != null)
            {
                CityLabel.Dispose();
                CityLabel = null;
            }

            if (DateLabel != null)
            {
                DateLabel.Dispose();
                DateLabel = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (GradeLabel != null)
            {
                GradeLabel.Dispose();
                GradeLabel = null;
            }

            if (NameLabel != null)
            {
                NameLabel.Dispose();
                NameLabel = null;
            }

            if (OwnerLabel != null)
            {
                OwnerLabel.Dispose();
                OwnerLabel = null;
            }

            if (PictureImageView != null)
            {
                PictureImageView.Dispose();
                PictureImageView = null;
            }

            if (PriceLabel != null)
            {
                PriceLabel.Dispose();
                PriceLabel = null;
            }
        }
예제 #7
0
        void ReleaseDesignerOutlets()
        {
            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (NameLabel != null)
            {
                NameLabel.Dispose();
                NameLabel = null;
            }
        }
예제 #8
0
        private void onTextFieldInfo(TextFieldInfo textFieldInfo)
        {
            var (attributedText, cursorPosition) = textFieldInfo.AsAttributedTextAndCursorPosition();
            if (DescriptionTextView.AttributedText.GetHashCode() == attributedText.GetHashCode())
                return;

            DescriptionTextView.InputDelegate = emptyInputDelegate; //This line is needed for when the user selects from suggestion and the iOS autocorrect is ready to add text at the same time. Without this line both will happen.
            DescriptionTextView.AttributedText = attributedText;
            var positionToSet =
                DescriptionTextView.GetPosition(DescriptionTextView.BeginningOfDocument, cursorPosition);
            DescriptionTextView.SelectedTextRange = DescriptionTextView.GetTextRange(positionToSet, positionToSet);

            updatePlaceholder();
        }
예제 #9
0
 void AddDismissKeyboardGesture()
 {
     this.View.AddGestureRecognizer(new UITapGestureRecognizer(() => {
         if (DescriptionTextView.IsFirstResponder)
         {
             DescriptionTextView.ResignFirstResponder();
         }
         if (SecretFileNameLabel.IsFirstResponder)
         {
             SecretFileNameLabel.ResignFirstResponder();
         }
     }));
     //when user presses "next" on lower right of keyboard
     SecretFileNameLabel.ShouldReturn += (textField) =>
     {
         ((UITextField)textField).ResignFirstResponder();
         return(true);
     };
 }
        private void onTextFieldInfo(TextFieldInfo textFieldInfo)
        {
            var attributedText = textFieldInfo.AsAttributedTextAndCursorPosition();

            if (DescriptionTextView.AttributedText.GetHashCode() == attributedText.GetHashCode())
            {
                return;
            }

            //This line is needed for when the user selects from suggestion and
            // the iOS autocorrect is ready to add text at the same time.
            // Without this line both will happen.
            DescriptionTextView.InputDelegate  = emptyInputDelegate;
            DescriptionTextView.AttributedText = attributedText;

            DescriptionTextView.RejectAutocorrect();

            updatePlaceholder();
        }
예제 #11
0
        private void prepareViews()
        {
            //This is needed for the ImageView.TintColor bindings to work
            foreach (var button in getButtons())
            {
                button.SetImage(
                    button.ImageForState(UIControlState.Normal)
                    .ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate),
                    UIControlState.Normal
                    );
                button.TintColor = Color.StartTimeEntry.InactiveButton.ToNativeColor();
            }

            TimeInput.TintColor = Color.StartTimeEntry.Cursor.ToNativeColor();

            DescriptionTextView.TintColor = Color.StartTimeEntry.Cursor.ToNativeColor();
            DescriptionTextView.BecomeFirstResponder();

            Placeholder.TextView = DescriptionTextView;
            Placeholder.Text     = Resources.StartTimeEntryPlaceholder;
        }
            private void RebindDescriptionTextView(Context ctx)
            {
                String text;
                int    taskLength        = 0;
                int    descriptionLength = 0;
                var    mode = SpanTypes.InclusiveExclusive;

                if (String.IsNullOrWhiteSpace(DataSource.Description))
                {
                    text = ctx.GetString(Resource.String.RecentTimeEntryNoDescription);
                    descriptionLength = text.Length;
                }
                else
                {
                    text = DataSource.Description;
                    descriptionLength = DataSource.Description.Length;
                }

                if (DataSource.Task != null && !String.IsNullOrEmpty(DataSource.Task.Name))
                {
                    taskLength = DataSource.Task.Name.Length;
                    text       = String.Concat(DataSource.Task.Name, "  ", text);
                }

                var spannable = new SpannableString(text);
                var start     = 0;
                var end       = taskLength;

                if (taskLength > 0)
                {
                    spannable.SetSpan(new FontSpan(Font.Roboto), start, end, mode);
                }

                start = taskLength > 0 ? taskLength + 2 : 0;
                end   = start + descriptionLength;
                spannable.SetSpan(new FontSpan(Font.RobotoLight), start, end, mode);

                DescriptionTextView.SetText(spannable, TextView.BufferType.Spannable);
            }
        void ReleaseDesignerOutlets()
        {
            if (buttonBack != null)
            {
                buttonBack.Dispose();
                buttonBack = null;
            }

            if (DateLabel != null)
            {
                DateLabel.Dispose();
                DateLabel = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (SeparatorView != null)
            {
                SeparatorView.Dispose();
                SeparatorView = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (TitleViewLabel != null)
            {
                TitleViewLabel.Dispose();
                TitleViewLabel = null;
            }
        }
예제 #14
0
        private void prepareViews()
        {
            //This is needed for the ImageView.TintColor bindings to work
            foreach (var button in getButtons())
            {
                button.SetImage(
                    button.ImageForState(UIControlState.Normal)
                    .ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate),
                    UIControlState.Normal
                    );
            }

            TimeLabel.Font = TimeLabel.Font.GetMonospacedDigitFont();

            var stringAttributes = new CTStringAttributes(
                new UIStringAttributes {
                ForegroundColor = Color.StartTimeEntry.Placeholder.ToNativeColor()
            }.Dictionary
                );

            DescriptionTextView.TintColor = Color.StartTimeEntry.Cursor.ToNativeColor();
            DescriptionTextView.BecomeFirstResponder();
        }
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     DescriptionTextView.BecomeFirstResponder();
 }
        void ReleaseDesignerOutlets()
        {
            if (AddProjectOnboardingBubble != null)
            {
                AddProjectOnboardingBubble.Dispose();
                AddProjectOnboardingBubble = null;
            }

            if (DescriptionRemainingLengthLabel != null)
            {
                DescriptionRemainingLengthLabel.Dispose();
                DescriptionRemainingLengthLabel = null;
            }

            if (Placeholder != null)
            {
                Placeholder.Dispose();
                Placeholder = null;
            }

            if (StartDateButton != null)
            {
                StartDateButton.Dispose();
                StartDateButton = null;
            }

            if (TimeInput != null)
            {
                TimeInput.Dispose();
                TimeInput = null;
            }

            if (TimeInputTrailingConstraint != null)
            {
                TimeInputTrailingConstraint.Dispose();
                TimeInputTrailingConstraint = null;
            }

            if (TimeLabel != null)
            {
                TimeLabel.Dispose();
                TimeLabel = null;
            }

            if (TimeLabelTrailingConstraint != null)
            {
                TimeLabelTrailingConstraint.Dispose();
                TimeLabelTrailingConstraint = null;
            }

            if (BillableButton != null)
            {
                BillableButton.Dispose();
                BillableButton = null;
            }

            if (BillableButtonWidthConstraint != null)
            {
                BillableButtonWidthConstraint.Dispose();
                BillableButtonWidthConstraint = null;
            }

            if (BottomDistanceConstraint != null)
            {
                BottomDistanceConstraint.Dispose();
                BottomDistanceConstraint = null;
            }

            if (BottomOptionsSheet != null)
            {
                BottomOptionsSheet.Dispose();
                BottomOptionsSheet = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (DateTimeButton != null)
            {
                DateTimeButton.Dispose();
                DateTimeButton = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (DoneButton != null)
            {
                DoneButton.Dispose();
                DoneButton = null;
            }

            if (ProjectsButton != null)
            {
                ProjectsButton.Dispose();
                ProjectsButton = null;
            }

            if (SuggestionsTableView != null)
            {
                SuggestionsTableView.Dispose();
                SuggestionsTableView = null;
            }

            if (TagsButton != null)
            {
                TagsButton.Dispose();
                TagsButton = null;
            }

            if (AddProjectBubbleLabel != null)
            {
                AddProjectBubbleLabel.Dispose();
                AddProjectBubbleLabel = null;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AddProjectBubbleLabel.Text = Resources.AddProjectBubbleText;

            prepareViews();
            prepareOnboarding();

            var source = new StartTimeEntryTableViewSource(SuggestionsTableView);

            SuggestionsTableView.Source = source;

            source.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectSuggestion.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.Suggestions
            .Subscribe(SuggestionsTableView.Rx().ReloadSections(source))
            .DisposedBy(DisposeBag);

            source.ToggleTasks
            .Subscribe(ViewModel.ToggleTasks.Inputs)
            .DisposedBy(DisposeBag);

            TimeInput.Rx().Duration()
            .Subscribe(ViewModel.SetRunningTime.Inputs)
            .DisposedBy(DisposeBag);

            //Text

            ViewModel.DisplayedTime
            .Subscribe(TimeLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            Placeholder.Text = ViewModel.PlaceholderText;

            // Buttons
            UIColor booleanToColor(bool b) => b
                ? Colors.StartTimeEntry.ActiveButton.ToNativeColor()
                : Colors.StartTimeEntry.InactiveButton.ToNativeColor();

            ViewModel.IsBillable
            .Select(booleanToColor)
            .Subscribe(BillableButton.Rx().TintColor())
            .DisposedBy(DisposeBag);

            ViewModel.IsSuggestingTags
            .Select(booleanToColor)
            .Subscribe(TagsButton.Rx().TintColor())
            .DisposedBy(DisposeBag);

            ViewModel.IsSuggestingProjects
            .Select(booleanToColor)
            .Subscribe(ProjectsButton.Rx().TintColor())
            .DisposedBy(DisposeBag);

            //Visibility
            ViewModel.IsBillableAvailable
            .Select(b => b ? (nfloat)42 : 0)
            .Subscribe(BillableButtonWidthConstraint.Rx().Constant())
            .DisposedBy(DisposeBag);

            // Actions
            CloseButton.Rx().Tap()
            .Subscribe(ViewModel.CloseWithDefaultResult)
            .DisposedBy(DisposeBag);

            DoneButton.Rx()
            .BindAction(ViewModel.Done)
            .DisposedBy(DisposeBag);

            ViewModel.Done.Elements
            .Subscribe(IosDependencyContainer.Instance.IntentDonationService.DonateStartTimeEntry)
            .DisposedBy(DisposeBag);

            BillableButton.Rx()
            .BindAction(ViewModel.ToggleBillable)
            .DisposedBy(DisposeBag);

            StartDateButton.Rx()
            .BindAction(ViewModel.SetStartDate)
            .DisposedBy(DisposeBag);

            DateTimeButton.Rx()
            .BindAction(ViewModel.ChangeTime)
            .DisposedBy(DisposeBag);

            TagsButton.Rx()
            .BindAction(ViewModel.ToggleTagSuggestions)
            .DisposedBy(DisposeBag);

            ProjectsButton.Rx()
            .BindAction(ViewModel.ToggleProjectSuggestions)
            .DisposedBy(DisposeBag);

            // Reactive
            ViewModel.TextFieldInfo
            .DistinctUntilChanged()
            .Subscribe(onTextFieldInfo)
            .DisposedBy(DisposeBag);

            DescriptionTextView.Rx().AttributedText()
            .Select(attributedString => attributedString.Length == 0)
            .Subscribe(isDescriptionEmptySubject)
            .DisposedBy(DisposeBag);

            Observable.CombineLatest(
                DescriptionTextView.Rx().AttributedText().SelectUnit(),
                DescriptionTextView.Rx().CursorPosition().SelectUnit()
                )
            .Select(_ => DescriptionTextView.AttributedText)     // Programatically changing the text doesn't send an event, that's why we do this, to get the last version of the text
            .Do(updatePlaceholder)
            .Select(text => text.AsSpans((int)DescriptionTextView.SelectedRange.Location).ToIImmutableList())
            .Subscribe(ViewModel.SetTextSpans.Inputs)
            .DisposedBy(DisposeBag);
        }
        void ReleaseDesignerOutlets()
        {
            if (CreatedDateLabel != null)
            {
                CreatedDateLabel.Dispose();
                CreatedDateLabel = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (DoneButton != null)
            {
                DoneButton.Dispose();
                DoneButton = null;
            }

            if (FinishedLabel != null)
            {
                FinishedLabel.Dispose();
                FinishedLabel = null;
            }

            if (FinishedValueLabel != null)
            {
                FinishedValueLabel.Dispose();
                FinishedValueLabel = null;
            }

            if (NumberOfMinutesValueLabel != null)
            {
                NumberOfMinutesValueLabel.Dispose();
                NumberOfMinutesValueLabel = null;
            }

            if (NumberOfPomodorosValueLable != null)
            {
                NumberOfPomodorosValueLable.Dispose();
                NumberOfPomodorosValueLable = null;
            }

            if (ScheduleButton != null)
            {
                ScheduleButton.Dispose();
                ScheduleButton = null;
            }

            if (ScheduledForLabel != null)
            {
                ScheduledForLabel.Dispose();
                ScheduledForLabel = null;
            }

            if (ScheduledForValueLabel != null)
            {
                ScheduledForValueLabel.Dispose();
                ScheduledForValueLabel = null;
            }

            if (StartPomodoroButton != null)
            {
                StartPomodoroButton.Dispose();
                StartPomodoroButton = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }
        }
예제 #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Set view title.
            Title = ViewModel.Title;

            // Set navigation bar style.
            this.SetNavigationBarStyle();

            // Add left navigation bar item.
            var leftNavigationButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (sender, e) =>
                                                           ViewModel.GoBackCommand.Execute(null));

            NavigationItem.LeftBarButtonItem = leftNavigationButton;

            // Add right navigation bar item.
            var rightNavigationButton = new UIBarButtonItem(UIBarButtonSystemItem.Save, (sender, e) =>
                                                            ViewModel.SaveDetailsCommand.Execute(null));

            NavigationItem.RightBarButtonItem = rightNavigationButton;

            // Adjust description text field border.
            DescriptionTextField.BorderStyle = UITextBorderStyle.RoundedRect;

            // Feed the text from text view into the text field which serves
            // as the visual frame.
            DescriptionTextView.Changed += (sender, e) =>
            {
                DescriptionTextField.Text = DescriptionTextView.Text;
                ViewModel.Validate();
            };

            // Register event handlers to trigger validation.
            NSNotificationCenter.DefaultCenter.AddObserver(UITextField.TextFieldTextDidChangeNotification, obj =>
            {
                ViewModel.Validate();
            });
            NSNotificationCenter.DefaultCenter.AddObserver(UITextView.TextDidChangeNotification, obj =>
            {
                ViewModel.Validate();
            });

            // Move the labels and fields up if needed.
            if (ViewModel.IsExisting)
            {
                DescriptionLabelTopConstraint.Constant = -50;
            }

            // Register event handlers to trigger focus flow.
            StreetNameTextField.ShouldReturn     += textField => DescriptionTextView.BecomeFirstResponder();
            RoomsTextField.ShouldReturn          += textField => LivingAreaTextField.BecomeFirstResponder();
            LivingAreaTextField.ShouldReturn     += textField => LotSizeTextField.BecomeFirstResponder();
            LotSizeTextField.ShouldReturn        += textField => OperatingCostsTextField.BecomeFirstResponder();
            OperatingCostsTextField.ShouldReturn += textField => OperatingCostsTextField.ResignFirstResponder();

            // Create and apply the binding set.
            var set = this.CreateBindingSet <DetailsView, DetailsViewModel>();

            set.Bind(StreetNameTextField).To(vm => vm.StreetName);
            set.Bind(StreetNameLabel).For("Visibility").To(vm => vm.IsExisting).WithConversion("InvertedVisibility");
            set.Bind(StreetNameTextField).For("Visibility").To(vm => vm.IsExisting).WithConversion("InvertedVisibility");
            set.Bind(DescriptionTextView).To(vm => vm.Details.Description);
            set.Bind(RoomsTextField).To(vm => vm.Details.Rooms);
            set.Bind(LivingAreaTextField).To(vm => vm.Details.LivingArea);
            set.Bind(LotSizeTextField).To(vm => vm.Details.LotSize);
            set.Bind(OperatingCostsTextField).To(vm => vm.Details.OperatingCosts);
            set.Bind(rightNavigationButton).For(b => b.Enabled).To(vm => vm.IsValid);
            set.Apply();
        }
예제 #20
0
        void ReleaseDesignerOutlets()
        {
            if (AddProjectAndTaskView != null)
            {
                AddProjectAndTaskView.Dispose();
                AddProjectAndTaskView = null;
            }

            if (AddTagsView != null)
            {
                AddTagsView.Dispose();
                AddTagsView = null;
            }

            if (BillableSwitch != null)
            {
                BillableSwitch.Dispose();
                BillableSwitch = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (ConfirmButton != null)
            {
                ConfirmButton.Dispose();
                ConfirmButton = null;
            }

            if (DeleteButton != null)
            {
                DeleteButton.Dispose();
                DeleteButton = null;
            }

            if (DurationLabel != null)
            {
                DurationLabel.Dispose();
                DurationLabel = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (ProjectTaskClientLabel != null)
            {
                ProjectTaskClientLabel.Dispose();
                ProjectTaskClientLabel = null;
            }

            if (StartDateLabel != null)
            {
                StartDateLabel.Dispose();
                StartDateLabel = null;
            }

            if (StartDateTimeView != null)
            {
                StartDateTimeView.Dispose();
                StartDateTimeView = null;
            }

            if (StartTimeLabel != null)
            {
                StartTimeLabel.Dispose();
                StartTimeLabel = null;
            }

            if (TagsLabel != null)
            {
                TagsLabel.Dispose();
                TagsLabel = null;
            }

            if (BillableView != null)
            {
                BillableView.Dispose();
                BillableView = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (ScrollViewContent != null)
            {
                ScrollViewContent.Dispose();
                ScrollViewContent = null;
            }
        }
예제 #21
0
        void ReleaseDesignerOutlets()
        {
            if (AmountDetailsView != null)
            {
                AmountDetailsView.Dispose();
                AmountDetailsView = null;
            }

            if (AmountLabel != null)
            {
                AmountLabel.Dispose();
                AmountLabel = null;
            }

            if (CardDetailsView != null)
            {
                CardDetailsView.Dispose();
                CardDetailsView = null;
            }

            if (CardExpirationLabel != null)
            {
                CardExpirationLabel.Dispose();
                CardExpirationLabel = null;
            }

            if (CardHolderNameLabel != null)
            {
                CardHolderNameLabel.Dispose();
                CardHolderNameLabel = null;
            }

            if (CardNumberLabel != null)
            {
                CardNumberLabel.Dispose();
                CardNumberLabel = null;
            }

            if (ContactSupportButton != null)
            {
                ContactSupportButton.Dispose();
                ContactSupportButton = null;
            }

            if (DateLabel != null)
            {
                DateLabel.Dispose();
                DateLabel = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (MerchantNameLabel != null)
            {
                MerchantNameLabel.Dispose();
                MerchantNameLabel = null;
            }
        }
예제 #22
0
        void ReleaseDesignerOutlets()
        {
            if (AddProjectAndTaskView != null)
            {
                AddProjectAndTaskView.Dispose();
                AddProjectAndTaskView = null;
            }

            if (AddProjectTaskLabel != null)
            {
                AddProjectTaskLabel.Dispose();
                AddProjectTaskLabel = null;
            }

            if (AddTagsLabel != null)
            {
                AddTagsLabel.Dispose();
                AddTagsLabel = null;
            }

            if (AddTagsView != null)
            {
                AddTagsView.Dispose();
                AddTagsView = null;
            }

            if (AddToSiriWrapperView != null)
            {
                AddToSiriWrapperView.Dispose();
                AddToSiriWrapperView = null;
            }

            if (BillabelLabel != null)
            {
                BillabelLabel.Dispose();
                BillabelLabel = null;
            }

            if (BillableSwitch != null)
            {
                BillableSwitch.Dispose();
                BillableSwitch = null;
            }

            if (BillableView != null)
            {
                BillableView.Dispose();
                BillableView = null;
            }

            if (DescriptionFromClipboardLabel != null)
            {
                DescriptionFromClipboardLabel.Dispose();
                DescriptionFromClipboardLabel = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (DescriptionUsingClipboardWrapperView != null)
            {
                DescriptionUsingClipboardWrapperView.Dispose();
                DescriptionUsingClipboardWrapperView = null;
            }

            if (DescriptionView != null)
            {
                DescriptionView.Dispose();
                DescriptionView = null;
            }

            if (PasteFromClipboardButton != null)
            {
                PasteFromClipboardButton.Dispose();
                PasteFromClipboardButton = null;
            }

            if (PasteFromClipboardHintLabel != null)
            {
                PasteFromClipboardHintLabel.Dispose();
                PasteFromClipboardHintLabel = null;
            }

            if (PasteFromClipboardHintView != null)
            {
                PasteFromClipboardHintView.Dispose();
                PasteFromClipboardHintView = null;
            }

            if (ProjectTaskClientLabel != null)
            {
                ProjectTaskClientLabel.Dispose();
                ProjectTaskClientLabel = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (ScrollViewContent != null)
            {
                ScrollViewContent.Dispose();
                ScrollViewContent = null;
            }

            if (SelectProjectView != null)
            {
                SelectProjectView.Dispose();
                SelectProjectView = null;
            }

            if (SelectTagsView != null)
            {
                SelectTagsView.Dispose();
                SelectTagsView = null;
            }

            if (TagsTextView != null)
            {
                TagsTextView.Dispose();
                TagsTextView = null;
            }
        }
예제 #23
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AddProjectBubbleLabel.Text = Resources.AddProjectBubbleText;

            prepareViews();
            prepareOnboarding();

            var source = new StartTimeEntryTableViewSource(SuggestionsTableView);

            SuggestionsTableView.Source = source;
            source.ToggleTasksCommand   = new MvxCommand <ProjectSuggestion>(toggleTaskSuggestions);

            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var invertedBoolConverter       = new BoolToConstantValueConverter <bool>(false, true);
            var buttonColorConverter        = new BoolToConstantValueConverter <UIColor>(
                Color.StartTimeEntry.ActiveButton.ToNativeColor(),
                Color.StartTimeEntry.InactiveButton.ToNativeColor()
                );
            var durationCombiner = new DurationValueCombiner();

            var bindingSet = this.CreateBindingSet <StartTimeEntryViewController, StartTimeEntryViewModel>();

            //TableView
            bindingSet.Bind(source)
            .For(v => v.ObservableCollection)
            .To(vm => vm.Suggestions);

            bindingSet.Bind(source)
            .For(v => v.UseGrouping)
            .To(vm => vm.UseGrouping);

            bindingSet.Bind(source)
            .For(v => v.SelectSuggestionCommand)
            .To(vm => vm.SelectSuggestionCommand);

            bindingSet.Bind(source)
            .For(v => v.CreateCommand)
            .To(vm => vm.CreateCommand);

            bindingSet.Bind(source)
            .For(v => v.IsSuggestingProjects)
            .To(vm => vm.IsSuggestingProjects);

            bindingSet.Bind(source)
            .For(v => v.Text)
            .To(vm => vm.CurrentQuery);

            bindingSet.Bind(source)
            .For(v => v.SuggestCreation)
            .To(vm => vm.SuggestCreation);

            bindingSet.Bind(source)
            .For(v => v.ShouldShowNoTagsInfoMessage)
            .To(vm => vm.ShouldShowNoTagsInfoMessage);

            bindingSet.Bind(source)
            .For(v => v.ShouldShowNoProjectsInfoMessage)
            .To(vm => vm.ShouldShowNoProjectsInfoMessage);

            //Text
            bindingSet.Bind(TimeInput)
            .For(v => v.Duration)
            .To(vm => vm.DisplayedTime)
            .Mode(MvxBindingMode.OneWayToSource);

            bindingSet.Bind(TimeLabel)
            .For(v => v.Text)
            .ByCombining(durationCombiner,
                         vm => vm.DisplayedTime,
                         vm => vm.DisplayedTimeFormat);

            bindingSet.Bind(Placeholder)
            .To(vm => vm.PlaceholderText);

            //Buttons
            bindingSet.Bind(TagsButton)
            .For(v => v.TintColor)
            .To(vm => vm.IsSuggestingTags)
            .WithConversion(buttonColorConverter);

            bindingSet.Bind(BillableButton)
            .For(v => v.TintColor)
            .To(vm => vm.IsBillable)
            .WithConversion(buttonColorConverter);

            bindingSet.Bind(ProjectsButton)
            .For(v => v.TintColor)
            .To(vm => vm.IsSuggestingProjects)
            .WithConversion(buttonColorConverter);

            //Visibility
            bindingSet.Bind(BillableButtonWidthConstraint)
            .For(v => v.Constant)
            .To(vm => vm.IsBillableAvailable)
            .WithConversion(new BoolToConstantValueConverter <nfloat>(42, 0));

            //Commands
            bindingSet.Bind(DoneButton).To(vm => vm.DoneCommand);
            bindingSet.Bind(CloseButton).To(vm => vm.BackCommand);
            bindingSet.Bind(BillableButton).To(vm => vm.ToggleBillableCommand);
            bindingSet.Bind(StartDateButton).To(vm => vm.SetStartDateCommand);
            bindingSet.Bind(DateTimeButton).To(vm => vm.ChangeTimeCommand);
            bindingSet.Bind(TagsButton).To(vm => vm.ToggleTagSuggestionsCommand);
            bindingSet.Bind(ProjectsButton).To(vm => vm.ToggleProjectSuggestionsCommand);

            bindingSet.Apply();

            // Reactive
            ViewModel.TextFieldInfoObservable
            .Subscribe(onTextFieldInfo)
            .DisposedBy(DisposeBag);

            DescriptionTextView.Rx().AttributedText()
            .Select(attributedString => attributedString.Length == 0)
            .Subscribe(isDescriptionEmptySubject)
            .DisposedBy(DisposeBag);

            DescriptionTextView.Rx().AttributedText()
            .CombineLatest(DescriptionTextView.Rx().CursorPosition(), (text, _) => text)
            .Where(_ => !isUpdatingDescriptionField)
            .SubscribeOn(ThreadPoolScheduler.Instance)
            .Do(updatePlaceholder)
            .Select(text => text.AsImmutableSpans((int)DescriptionTextView.SelectedRange.Location))
            .ObserveOn(SynchronizationContext.Current)
            .Subscribe(async info => await ViewModel.OnTextFieldInfoFromView(info))
            .DisposedBy(DisposeBag);

            source.TableRenderCallback = () =>
            {
                ViewModel.StopSuggestionsRenderingStopwatch();
            };
        }
예제 #24
0
        void ReleaseDesignerOutlets()
        {
            if (AddProjectAndTaskView != null)
            {
                AddProjectAndTaskView.Dispose();
                AddProjectAndTaskView = null;
            }

            if (AddTagsView != null)
            {
                AddTagsView.Dispose();
                AddTagsView = null;
            }

            if (BillableSwitch != null)
            {
                BillableSwitch.Dispose();
                BillableSwitch = null;
            }

            if (BillableView != null)
            {
                BillableView.Dispose();
                BillableView = null;
            }

            if (CategorizeWithProjectsBubbleView != null)
            {
                CategorizeWithProjectsBubbleView.Dispose();
                CategorizeWithProjectsBubbleView = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (ConfirmButton != null)
            {
                ConfirmButton.Dispose();
                ConfirmButton = null;
            }

            if (ConfirmButtonBottomConstraint != null)
            {
                ConfirmButtonBottomConstraint.Dispose();
                ConfirmButtonBottomConstraint = null;
            }

            if (DeleteButton != null)
            {
                DeleteButton.Dispose();
                DeleteButton = null;
            }

            if (DeleteButtonBottomConstraint != null)
            {
                DeleteButtonBottomConstraint.Dispose();
                DeleteButtonBottomConstraint = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (DurationLabel != null)
            {
                DurationLabel.Dispose();
                DurationLabel = null;
            }

            if (DurationView != null)
            {
                DurationView.Dispose();
                DurationView = null;
            }

            if (EndTimeLabel != null)
            {
                EndTimeLabel.Dispose();
                EndTimeLabel = null;
            }

            if (EndTimeView != null)
            {
                EndTimeView.Dispose();
                EndTimeView = null;
            }

            if (ErrorMessageLabel != null)
            {
                ErrorMessageLabel.Dispose();
                ErrorMessageLabel = null;
            }

            if (ErrorView != null)
            {
                ErrorView.Dispose();
                ErrorView = null;
            }

            if (ProjectTaskClientLabel != null)
            {
                ProjectTaskClientLabel.Dispose();
                ProjectTaskClientLabel = null;
            }

            if (RemainingCharacterCount != null)
            {
                RemainingCharacterCount.Dispose();
                RemainingCharacterCount = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (ScrollViewContent != null)
            {
                ScrollViewContent.Dispose();
                ScrollViewContent = null;
            }

            if (StartDateLabel != null)
            {
                StartDateLabel.Dispose();
                StartDateLabel = null;
            }

            if (StartDateView != null)
            {
                StartDateView.Dispose();
                StartDateView = null;
            }

            if (StartTimeLabel != null)
            {
                StartTimeLabel.Dispose();
                StartTimeLabel = null;
            }

            if (StartTimeView != null)
            {
                StartTimeView.Dispose();
                StartTimeView = null;
            }

            if (StopButton != null)
            {
                StopButton.Dispose();
                StopButton = null;
            }

            if (TagsContainerView != null)
            {
                TagsContainerView.Dispose();
                TagsContainerView = null;
            }

            if (TagsSeparator != null)
            {
                TagsSeparator.Dispose();
                TagsSeparator = null;
            }

            if (TagsTextView != null)
            {
                TagsTextView.Dispose();
                TagsTextView = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (BillableLabel != null)
            {
                BillableLabel.Dispose();
                BillableLabel = null;
            }

            if (StartDateDescriptionLabel != null)
            {
                StartDateDescriptionLabel.Dispose();
                StartDateDescriptionLabel = null;
            }

            if (DurationDescriptionLabel != null)
            {
                DurationDescriptionLabel.Dispose();
                DurationDescriptionLabel = null;
            }

            if (StartDescriptionLabel != null)
            {
                StartDescriptionLabel.Dispose();
                StartDescriptionLabel = null;
            }

            if (EndDescriptionLabel != null)
            {
                EndDescriptionLabel.Dispose();
                EndDescriptionLabel = null;
            }

            if (ErrorMessageTitleLabel != null)
            {
                ErrorMessageTitleLabel.Dispose();
                ErrorMessageTitleLabel = null;
            }

            if (AddProjectTaskLabel != null)
            {
                AddProjectTaskLabel.Dispose();
                AddProjectTaskLabel = null;
            }

            if (CategorizeWithProjectsLabel != null)
            {
                CategorizeWithProjectsLabel.Dispose();
                CategorizeWithProjectsLabel = null;
            }

            if (AddTagsLabel != null)
            {
                AddTagsLabel.Dispose();
                AddTagsLabel = null;
            }
        }
예제 #25
0
 protected override void Rebind()
 {
     TitleTextView.SetText(DataSource.TitleResId);
     DescriptionTextView.SetText(DataSource.DescriptionResId);
     CheckBox.Checked = DataSource.IsChecked;
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();
            prepareSiriButton();
            localizeLabels();

            BillableSwitch.Rx().Changed()
            .Select(_ => BillableSwitch.On)
            .Subscribe(ViewModel.IsBillable.Accept)
            .DisposedBy(DisposeBag);

            TagsTextView.Rx()
            .BindAction(ViewModel.SelectTags)
            .DisposedBy(DisposeBag);

            ViewModel.HasTags
            .Invert()
            .Subscribe(AddTagsView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.HasTags
            .Subscribe(TagsTextView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.TagNames
            .Select(tagsListToAttributedString.Convert)
            .Subscribe(TagsTextView.Rx().AttributedTextObserver())
            .DisposedBy(DisposeBag);

            SelectTagsView.Rx()
            .BindAction(ViewModel.SelectTags)
            .DisposedBy(DisposeBag);

            SelectProjectView.Rx()
            .BindAction(ViewModel.SelectProject)
            .DisposedBy(DisposeBag);

            ViewModel.ProjectClientTask
            .Select(info => projectTaskClientToAttributedString.Convert(
                        info.Project,
                        info.Task,
                        info.Client,
                        new Color(info.ProjectColor).ToNativeColor()))
            .Subscribe(ProjectTaskClientLabel.Rx().AttributedText())
            .DisposedBy(DisposeBag);

            ViewModel.ProjectClientTask
            .Select(info => info.HasProject)
            .Subscribe(ProjectTaskClientLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.ProjectClientTask
            .Select(info => !info.HasProject)
            .Subscribe(AddProjectAndTaskView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsBillable
            .Subscribe(BillableSwitch.Rx().CheckedObserver())
            .DisposedBy(DisposeBag);

            ViewModel.IsBillableAvailable
            .Subscribe(BillableView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PasteFromClipboard
            .Invert()
            .Subscribe(DescriptionTextView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PasteFromClipboard
            .Subscribe(DescriptionUsingClipboardWrapperView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PasteFromClipboard
            .Subscribe(PasteFromClipboardHintView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PasteFromClipboard
            .Select(enabled => enabled ? pasteFromClipboardButtonImageEnabled : pasteFromClipboardButtonImage)
            .Subscribe(image =>
            {
                PasteFromClipboardButton.SetImage(image, UIControlState.Normal);
            })
            .DisposedBy(DisposeBag);

            ViewModel.PasteFromClipboard
            .Subscribe(enabled =>
            {
                if (enabled)
                {
                    DescriptionTextView.ResignFirstResponder();
                }
                else
                {
                    DescriptionTextView.BecomeFirstResponder();
                }
            })
            .DisposedBy(DisposeBag);

            DescriptionTextView.TextObservable
            .Subscribe(ViewModel.Description.Accept)
            .DisposedBy(DisposeBag);

            PasteFromClipboardButton.Rx()
            .BindAction(ViewModel.SelectClipboard)
            .DisposedBy(DisposeBag);
        }
        void ReleaseDesignerOutlets()
        {
            if (ContentView != null)
            {
                ContentView.Dispose();
                ContentView = null;
            }

            if (DescriptionTextField != null)
            {
                DescriptionTextField.Dispose();
                DescriptionTextField = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (LivingAreaTextField != null)
            {
                LivingAreaTextField.Dispose();
                LivingAreaTextField = null;
            }

            if (LotSizeTextField != null)
            {
                LotSizeTextField.Dispose();
                LotSizeTextField = null;
            }

            if (OperatingCostsTextField != null)
            {
                OperatingCostsTextField.Dispose();
                OperatingCostsTextField = null;
            }

            if (RoomsTextField != null)
            {
                RoomsTextField.Dispose();
                RoomsTextField = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (StreetNameLabel != null)
            {
                StreetNameLabel.Dispose();
                StreetNameLabel = null;
            }

            if (StreetNameTextField != null)
            {
                StreetNameTextField.Dispose();
                StreetNameTextField = null;
            }

            if (DescriptionLabelTopConstraint != null)
            {
                DescriptionLabelTopConstraint.Dispose();
                DescriptionLabelTopConstraint = null;
            }
        }
예제 #28
0
        void ReleaseDesignerOutlets()
        {
            if (BillableButton != null)
            {
                BillableButton.Dispose();
                BillableButton = null;
            }

            if (BillableButtonWidthConstraint != null)
            {
                BillableButtonWidthConstraint.Dispose();
                BillableButtonWidthConstraint = null;
            }

            if (BottomDistanceConstraint != null)
            {
                BottomDistanceConstraint.Dispose();
                BottomDistanceConstraint = null;
            }

            if (BottomOptionsSheet != null)
            {
                BottomOptionsSheet.Dispose();
                BottomOptionsSheet = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (DateTimeButton != null)
            {
                DateTimeButton.Dispose();
                DateTimeButton = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (DoneButton != null)
            {
                DoneButton.Dispose();
                DoneButton = null;
            }

            if (DurationButton != null)
            {
                DurationButton.Dispose();
                DurationButton = null;
            }

            if (ProjectsButton != null)
            {
                ProjectsButton.Dispose();
                ProjectsButton = null;
            }

            if (SuggestionsTableView != null)
            {
                SuggestionsTableView.Dispose();
                SuggestionsTableView = null;
            }

            if (TagsButton != null)
            {
                TagsButton.Dispose();
                TagsButton = null;
            }

            if (TimeLabel != null)
            {
                TimeLabel.Dispose();
                TimeLabel = null;
            }
        }