Пример #1
0
        public void InvertedVisibilityValueConverter_Test(bool visible, bool hide, MvxVisibility expected)
        {
            var converter = new MvxInvertedVisibilityValueConverter();
            var result    = converter.Convert(visible, typeof(bool), hide, CultureInfo.CurrentUICulture);

            Assert.Equal(expected, result);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Empty state button config
            EmptyStateButton.Layer.BorderWidth = 1;
            EmptyStateButton.Layer.BorderColor = Color.TimeEntriesLog.ButtonBorder.ToNativeColor().CGColor;
            EmptyStateButton.SetTitle(Resources.TimeEntriesLogEmptyStateButton, UIControlState.Normal);

            //TableView config
            var source = new TimeEntriesLogViewSource(TimeEntriesTableView);

            TimeEntriesTableView.Source = source;

            //Converters
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();

            var bindingSet = this.CreateBindingSet <TimeEntriesLogViewController, TimeEntriesLogViewModel>();

            //Text
            bindingSet.Bind(EmptyStateTextLabel).To(vm => vm.EmptyStateText);
            bindingSet.Bind(EmptyStateTitleLabel).To(vm => vm.EmptyStateTitle);

            //Time entries log
            bindingSet.Bind(source).To(vm => vm.TimeEntries);

            //Visibility
            bindingSet.Bind(EmptyStateView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(EmptyStateButton)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsWelcome)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(TimeEntriesTableView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(EmptyStateImageView)
            .For(v => v.BindVisibility())
            .To($"{nameof(TimeEntriesLogViewModel.IsEmpty)}&&!{nameof(TimeEntriesLogViewModel.IsWelcome)}")
            .WithConversion(visibilityConverter);

            bindingSet.Bind(WelcomeImageView)
            .For(v => v.BindVisibility())
            .To($"{nameof(TimeEntriesLogViewModel.IsEmpty)}&&{nameof(TimeEntriesLogViewModel.IsWelcome)}")
            .WithConversion(visibilityConverter);

            //Commands
            bindingSet.Bind(source)
            .For(s => s.SelectionChangedCommand)
            .To(vm => vm.EditCommand);

            bindingSet.Apply();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            var colorConverter              = new MvxNativeColorValueConverter();
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var timeSpanConverter           = new TimeSpanToDurationValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();

            var bindingSet = this.CreateBindingSet <MainViewController, MainViewModel>();

            //Commands
            bindingSet.Bind(settingsButton).To(vm => vm.OpenSettingsCommand);
            bindingSet.Bind(StopTimeEntryButton).To(vm => vm.StopTimeEntryCommand);
            bindingSet.Bind(StartTimeEntryButton).To(vm => vm.StartTimeEntryCommand);
            bindingSet.Bind(EditTimeEntryButton).To(vm => vm.EditTimeEntryCommand);
            bindingSet.Bind(MainPagedScrollView)
            .For(v => v.RefreshCommand)
            .To(vm => vm.RefreshCommand);

            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindTap())
            .To(vm => vm.EditTimeEntryCommand);

            //Visibility
            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindVisibility())
            .To(vm => vm.CurrentlyRunningTimeEntry)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(StartTimeEntryButton)
            .For(v => v.BindVisibility())
            .To(vm => vm.CurrentlyRunningTimeEntry)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(SpiderBroImageView)
            .For(v => v.BindVisibility())
            .To(vm => vm.SpiderIsVisible)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(SyncIndicatorView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsSyncing)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(MainPagedScrollView)
            .For(v => v.IsSyncing)
            .To(vm => vm.IsSyncing);

            //Text
            bindingSet.Bind(CurrentTimeEntryDescriptionLabel).To(vm => vm.CurrentlyRunningTimeEntry.Description);
            bindingSet.Bind(CurrentTimeEntryElapsedTimeLabel)
            .To(vm => vm.CurrentTimeEntryElapsedTime)
            .WithConversion(timeSpanConverter);

            bindingSet.Apply();
        }
Пример #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //TableView config
            var source = new TimeEntriesLogViewSource(TimeEntriesTableView);

            TimeEntriesTableView.Source = source;

            //Converters
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();

            var bindingSet = this.CreateBindingSet <TimeEntriesLogViewController, TimeEntriesLogViewModel>();

            //Text
            bindingSet.Bind(EmptyStateTextLabel).To(vm => vm.EmptyStateText);
            bindingSet.Bind(EmptyStateTitleLabel).To(vm => vm.EmptyStateTitle);

            //Time entries log
            bindingSet.Bind(source).To(vm => vm.TimeEntries);

            //Visibility
            bindingSet.Bind(EmptyStateView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(TimeEntriesTableView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(EmptyStateImageView)
            .For(v => v.BindVisibility())
            .To($"{nameof(TimeEntriesLogViewModel.IsEmpty)}&&!{nameof(TimeEntriesLogViewModel.IsWelcome)}")
            .WithConversion(visibilityConverter);

            bindingSet.Bind(WelcomeImageView)
            .For(v => v.BindVisibility())
            .To($"{nameof(TimeEntriesLogViewModel.IsEmpty)}&&{nameof(TimeEntriesLogViewModel.IsWelcome)}")
            .WithConversion(visibilityConverter);

            //Commands
            bindingSet.Bind(source)
            .For(s => s.SelectionChangedCommand)
            .To(vm => vm.EditCommand);

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

            bindingSet.Apply();
        }
Пример #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CurrentTimeEntryCard.Layer.BorderWidth  = 1;
            CurrentTimeEntryCard.Layer.CornerRadius = 8;
            CurrentTimeEntryCard.Layer.BorderColor  = Color.TimeEntriesLog.ButtonBorder.ToNativeColor().CGColor;
            CurrentTimeEntryElapsedTimeLabel.Font   = CurrentTimeEntryElapsedTimeLabel.Font.GetMonospacedDigitFont();

            StartTimeEntryButton.Transform = CGAffineTransform.MakeScale(0.01f, 0.01f);
            reportsButton.SetImage(UIImage.FromBundle("icReports"), UIControlState.Normal);
            settingsButton.SetImage(UIImage.FromBundle("icSettings"), UIControlState.Normal);

            var visibilityConverter         = new MvxVisibilityValueConverter();
            var timeSpanConverter           = new TimeSpanToDurationValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();

            var bindingSet = this.CreateBindingSet <MainViewController, MainViewModel>();

            //Commands
            bindingSet.Bind(settingsButton).To(vm => vm.OpenSettingsCommand);
            bindingSet.Bind(StopTimeEntryButton).To(vm => vm.StopTimeEntryCommand);
            bindingSet.Bind(StartTimeEntryButton).To(vm => vm.StartTimeEntryCommand);
            bindingSet.Bind(EditTimeEntryButton).To(vm => vm.EditTimeEntryCommand);
            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindTap())
            .To(vm => vm.EditTimeEntryCommand);

            //Visibility
            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindVisibility())
            .To(vm => vm.CurrentlyRunningTimeEntry)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(StartTimeEntryButton)
            .For(v => v.BindVisibility())
            .To(vm => vm.CurrentlyRunningTimeEntry)
            .WithConversion(invertedVisibilityConverter);

            //Text
            bindingSet.Bind(CurrentTimeEntryDescriptionLabel).To(vm => vm.CurrentlyRunningTimeEntry.Description);

            bindingSet.Bind(CurrentTimeEntryElapsedTimeLabel)
            .To(vm => vm.CurrentTimeEntryElapsedTime)
            .WithConversion(timeSpanConverter);

            bindingSet.Apply();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Empty state button config
            EmptyStateButton.Layer.BorderWidth = 1;
            EmptyStateButton.Layer.BorderColor = Color.TimeEntriesLog.ButtonBorder.ToNativeColor().CGColor;
            EmptyStateButton.SetTitle(Resources.TimeEntriesLogEmptyStateButton, UIControlState.Normal);

            //TableView config
            var source = new GroupBindingTableViewSource <DateTime, ITimeEntry>(
                TimeEntriesTableView, nameof(TimeEntriesLogHeaderViewCell), nameof(TimeEntriesLogViewCell)
                );

            TimeEntriesTableView.Source = source;

            //Converters
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();

            var bindingSet = this.CreateBindingSet <TimeEntriesLogViewController, TimeEntriesLogViewModel>();

            //Text
            bindingSet.Bind(EmptyStateTextLabel).To(vm => vm.EmptyStateText);
            bindingSet.Bind(EmptyStateTitleLabel).To(vm => vm.EmptyStateTitle);

            //Time entries log
            bindingSet.Bind(source).To(vm => vm.TimeEntries);

            //Visibility
            bindingSet.Bind(EmptyStateView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(EmptyStateButton)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsWelcome)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(TimeEntriesTableView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Apply();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TitleLabel.Text                  = Resources.Edit;
            BillableLabel.Text               = Resources.Billable;
            StartDateDescriptionLabel.Text   = Resources.Startdate;
            DurationDescriptionLabel.Text    = Resources.Duration;
            StartDescriptionLabel.Text       = Resources.Start;
            EndDescriptionLabel.Text         = Resources.End;
            ErrorMessageTitleLabel.Text      = Resources.Oops;
            AddProjectTaskLabel.Text         = Resources.AddProjectTask;
            CategorizeWithProjectsLabel.Text = Resources.CategorizeYourTimeWithProjects;
            AddTagsLabel.Text                = Resources.AddTags;
            DeleteButton.SetTitle(Resources.Delete, UIControlState.Normal);
            ConfirmButton.SetTitle(Resources.ConfirmChanges, UIControlState.Normal);

            prepareViews();
            prepareOnboarding();

            contentSizeChangedDisposable = ScrollViewContent.AddObserver(boundsKey, NSKeyValueObservingOptions.New, onContentSizeChanged);

            var durationCombiner            = new DurationValueCombiner();
            var dateCombiner                = new DateTimeOffsetDateFormatValueCombiner(TimeZoneInfo.Local);
            var timeCombiner                = new DateTimeOffsetTimeFormatValueCombiner(TimeZoneInfo.Local);
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedBoolConverter       = new BoolToConstantValueConverter <bool>(false, true);
            var inverterVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var projectTaskClientCombiner   = new ProjectTaskClientValueCombiner(
                ProjectTaskClientLabel.Font.CapHeight,
                Color.EditTimeEntry.ClientText.ToNativeColor(),
                false
                );
            var stopRunningTimeEntryAndSelectStopTimeForStoppedConverter = new BoolToConstantValueConverter <IMvxCommand>(
                ViewModel.StopCommand, ViewModel.SelectStopTimeCommand);

            var isInaccessibleTextColorConverter = new BoolToConstantValueConverter <UIColor>(
                Color.Common.Disabled.ToNativeColor(),
                Color.Common.TextColor.ToNativeColor()
                );

            var showTagsCombiner = new ShowTagsValueCombiner();

            var bindingSet = this.CreateBindingSet <EditTimeEntryViewController, EditTimeEntryViewModel>();

            //Error message view
            bindingSet.Bind(ErrorMessageLabel)
            .For(v => v.Text)
            .To(vm => vm.SyncErrorMessage);

            bindingSet.Bind(ErrorView)
            .For(v => v.BindTap())
            .To(vm => vm.DismissSyncErrorMessageCommand);

            bindingSet.Bind(ErrorView)
            .For(v => v.BindVisible())
            .To(vm => vm.SyncErrorMessageVisible)
            .WithConversion(inverterVisibilityConverter);

            //Text
            bindingSet.Bind(RemainingCharacterCount)
            .To(vm => vm.DescriptionRemainingLength);

            bindingSet.Bind(RemainingCharacterCount)
            .For(v => v.BindVisible())
            .To(vm => vm.DescriptionLimitExceeded);

            bindingSet.Bind(DescriptionTextView)
            .For(v => v.BindText())
            .To(vm => vm.Description);

            bindingSet.Bind(DescriptionTextView)
            .For(v => v.BindDidBecomeFirstResponder())
            .To(vm => vm.StartEditingDescriptionCommand);

            bindingSet.Bind(DurationLabel)
            .ByCombining(durationCombiner,
                         vm => vm.Duration,
                         vm => vm.DurationFormat);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.AttributedText)
            .ByCombining(projectTaskClientCombiner,
                         v => v.Project,
                         v => v.Task,
                         v => v.Client,
                         v => v.ProjectColor);

            bindingSet.Bind(StartDateLabel)
            .ByCombining(dateCombiner,
                         vm => vm.StartTime,
                         vm => vm.DateFormat);

            bindingSet.Bind(StartTimeLabel)
            .ByCombining(timeCombiner,
                         vm => vm.StartTime,
                         vm => vm.TimeFormat);

            bindingSet.Bind(EndTimeLabel)
            .ByCombining(timeCombiner,
                         vm => vm.StopTime,
                         vm => vm.TimeFormat);

            //Commands
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(DeleteButton).To(vm => vm.DeleteCommand);
            bindingSet.Bind(ConfirmButton).To(vm => vm.SaveCommand);

            bindingSet.Bind(DurationView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectDurationCommand);

            bindingSet.Bind(StartTimeView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectStartTimeCommand);

            bindingSet.Bind(StopButton)
            .To(vm => vm.StopCommand);

            bindingSet.Bind(EndTimeView)
            .For(v => v.BindTap())
            .To(vm => vm.IsTimeEntryRunning)
            .WithConversion(stopRunningTimeEntryAndSelectStopTimeForStoppedConverter);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.BindTap())
            .To(vm => vm.SelectProjectCommand);

            bindingSet.Bind(AddProjectAndTaskView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectProjectCommand);

            bindingSet.Bind(StartDateView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectStartDateCommand);

            bindingSet.Bind(TagsTextView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectTagsCommand);

            bindingSet.Bind(AddTagsView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectTagsCommand);

            bindingSet.Bind(BillableSwitch)
            .For(v => v.BindValueChanged())
            .To(vm => vm.ToggleBillableCommand);

            //End time and the stop button visibility
            bindingSet.Bind(StopButton)
            .For(v => v.BindVisible())
            .To(vm => vm.IsTimeEntryRunning)
            .WithConversion(inverterVisibilityConverter);

            bindingSet.Bind(EndTimeLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.IsTimeEntryRunning)
            .WithConversion(visibilityConverter);

            //Project visibility
            bindingSet.Bind(AddProjectAndTaskView)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(inverterVisibilityConverter);

            //Tags visibility
            bindingSet.Bind(AddTagsView)
            .For(v => v.BindVisible())
            .To(vm => vm.HasTags)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(TagsTextView)
            .For(v => v.BindVisible())
            .To(vm => vm.HasTags)
            .WithConversion(inverterVisibilityConverter);

            //Confirm button enabled
            bindingSet.Bind(ConfirmButton)
            .For(v => v.Enabled)
            .To(vm => vm.DescriptionLimitExceeded)
            .WithConversion(invertedBoolConverter);

            bindingSet.Bind(ConfirmButton)
            .For(v => v.Alpha)
            .To(vm => vm.DescriptionLimitExceeded)
            .WithConversion(new BoolToConstantValueConverter <nfloat>(0.5f, 1));

            bindingSet.Bind(BillableView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsBillableAvailable)
            .WithConversion(visibilityConverter);

            //Regarding inaccessible entries
            getLabelsToChangeColorWhenEditingInaccessibleEntry().ForEach(createTextColorBindingForInaccessibleEntries);

            bindingSet.Bind(DescriptionTextView)
            .For(v => v.TextColor)
            .To(vm => vm.IsInaccessible)
            .WithConversion(isInaccessibleTextColorConverter);

            bindingSet.Bind(DescriptionTextView)
            .For(v => v.UserInteractionEnabled)
            .To(vm => vm.IsInaccessible)
            .WithConversion(invertedBoolConverter);

            bindingSet.Bind(BillableSwitch)
            .For(v => v.Enabled)
            .To(vm => vm.IsInaccessible)
            .WithConversion(invertedBoolConverter);

            bindingSet.Bind(TagsContainerView)
            .For(v => v.Hidden)
            .ByCombining(showTagsCombiner,
                         vm => vm.IsInaccessible,
                         vm => vm.HasTags)
            .WithConversion(invertedBoolConverter);

            bindingSet.Bind(TagsSeparator)
            .For(v => v.Hidden)
            .ByCombining(showTagsCombiner,
                         vm => vm.IsInaccessible,
                         vm => vm.HasTags)
            .WithConversion(invertedBoolConverter);

            bindingSet.Apply();

            void createTextColorBindingForInaccessibleEntries(UILabel label)
            {
                bindingSet.Bind(label)
                .For(v => v.TextColor)
                .To(vm => vm.IsInaccessible)
                .WithConversion(isInaccessibleTextColorConverter);
            }
        }
Пример #8
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            FadeView.FadeRight = true;

            TimeLabel.Font = TimeLabel.Font.GetMonospacedDigitFont();
            ContinueButton.TouchUpInside += onContinueButtonTap;

            this.DelayBind(() =>
            {
                var colorConverter              = new MvxRGBValueConverter();
                var visibilityConverter         = new MvxVisibilityValueConverter();
                var timeSpanConverter           = new TimeSpanToDurationValueConverter();
                var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();
                var projectTaskClientCombiner   = new ProjectTaskClientValueCombiner(
                    ProjectTaskClientLabel.Font.CapHeight,
                    Color.TimeEntriesLog.ClientColor.ToNativeColor(),
                    true
                    );
                var descriptionTopDistanceValueConverter =
                    new BoolToConstantValueConverter <nfloat>(hasProjectDistance, noProjectDistance);

                var bindingSet = this.CreateBindingSet <TimeEntriesLogViewCell, TimeEntryViewModel>();

                //Text
                bindingSet.Bind(DescriptionLabel).To(vm => vm.Description);
                bindingSet.Bind(ProjectTaskClientLabel)
                .For(v => v.AttributedText)
                .ByCombining(projectTaskClientCombiner,
                             v => v.ProjectName,
                             v => v.TaskName,
                             v => v.ClientName,
                             v => v.ProjectColor);

                bindingSet.Bind(TimeLabel)
                .To(vm => vm.Duration)
                .WithConversion(timeSpanConverter);

                //Visibility
                bindingSet.Bind(DescriptionTopDistanceConstraint)
                .For(v => v.Constant)
                .To(vm => vm.HasProject)
                .WithConversion(descriptionTopDistanceValueConverter);

                bindingSet.Bind(ProjectTaskClientLabel)
                .For(v => v.BindVisibility())
                .To(vm => vm.HasProject)
                .WithConversion(visibilityConverter);

                bindingSet.Bind(AddDescriptionLabel)
                .For(v => v.BindVisibility())
                .To(vm => vm.HasDescription)
                .WithConversion(invertedVisibilityConverter);

                bindingSet.Bind(AddDescriptionTopDistanceConstraint)
                .For(v => v.Constant)
                .To(vm => vm.HasProject)
                .WithConversion(descriptionTopDistanceValueConverter);

                bindingSet.Bind(SyncErrorImageView)
                .For(v => v.BindVisibility())
                .To(vm => vm.CanSync)
                .WithConversion(invertedVisibilityConverter);

                bindingSet.Bind(UnsyncedImageView)
                .For(v => v.BindVisibility())
                .To(vm => vm.NeedsSync)
                .WithConversion(visibilityConverter);

                bindingSet.Bind(ContinueButton)
                .For(v => v.BindVisibility())
                .To(vm => vm.CanSync)
                .WithConversion(visibilityConverter);

                bindingSet.Bind(ContinueImageView)
                .For(v => v.BindVisibility())
                .To(vm => vm.CanSync)
                .WithConversion(visibilityConverter);

                bindingSet.Apply();
            });
        }
Пример #9
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();
            };
        }
Пример #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            var colorConverter              = new MvxNativeColorValueConverter();
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var timeSpanConverter           = new TimeSpanToDurationValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var projectTaskClientCombiner   = new ProjectTaskClientValueCombiner(
                CurrentTimeEntryProjectTaskClientLabel.Font.CapHeight,
                Color.Main.CurrentTimeEntryClientColor.ToNativeColor(),
                true
                );

            var bindingSet = this.CreateBindingSet <MainViewController, MainViewModel>();

            //Commands
            bindingSet.Bind(settingsButton).To(vm => vm.OpenSettingsCommand);
            bindingSet.Bind(StopTimeEntryButton).To(vm => vm.StopTimeEntryCommand);
            bindingSet.Bind(StartTimeEntryButton).To(vm => vm.StartTimeEntryCommand);
            bindingSet.Bind(EditTimeEntryButton).To(vm => vm.EditTimeEntryCommand);
            bindingSet.Bind(MainPagedScrollView)
            .For(v => v.RefreshCommand)
            .To(vm => vm.RefreshCommand);

            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindTap())
            .To(vm => vm.EditTimeEntryCommand);

            //Visibility
            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindVisibility())
            .To(vm => vm.HasCurrentTimeEntry)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(StartTimeEntryButton)
            .For(v => v.BindVisibility())
            .To(vm => vm.HasCurrentTimeEntry)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(SpiderBroImageView)
            .For(v => v.BindVisibility())
            .To(vm => vm.SpiderIsVisible)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(SpiderHinge)
            .For(v => v.BindVisibility())
            .To(vm => vm.SpiderIsVisible)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(SyncIndicatorView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsSyncing)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(MainPagedScrollView)
            .For(v => v.IsSyncing)
            .To(vm => vm.IsSyncing);

            //Text
            bindingSet.Bind(CurrentTimeEntryDescriptionLabel).To(vm => vm.CurrentTimeEntryDescription);
            bindingSet.Bind(CurrentTimeEntryElapsedTimeLabel)
            .To(vm => vm.CurrentTimeEntryElapsedTime)
            .WithConversion(timeSpanConverter);

            bindingSet.Bind(CurrentTimeEntryProjectTaskClientLabel)
            .For(v => v.AttributedText)
            .ByCombining(projectTaskClientCombiner,
                         v => v.CurrentTimeEntryProject,
                         v => v.CurrentTimeEntryTask,
                         v => v.CurrentTimeEntryClient,
                         v => v.CurrentTimeEntryProjectColor);

            bindingSet.Apply();
        }
Пример #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var signupButtonTitleConverter  = new BoolToConstantValueConverter <string>("", Resources.SignUpTitle);
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();

            var bindingSet = this.CreateBindingSet <SignupViewController, SignupViewModel>();

            //Text
            bindingSet.Bind(ErrorLabel).To(vm => vm.ErrorText);
            bindingSet.Bind(EmailTextField)
            .To(vm => vm.Email)
            .WithConversion(new EmailToStringValueConverter());

            bindingSet.Bind(PasswordTextField)
            .To(vm => vm.Password)
            .WithConversion(new PasswordToStringValueConverter());

            bindingSet.Bind(SignupButton)
            .For(v => v.BindAnimatedTitle())
            .To(vm => vm.IsLoading)
            .WithConversion(signupButtonTitleConverter);

            bindingSet.Bind(SelectCountryButton)
            .For(v => v.BindAnimatedTitle())
            .To(vm => vm.CountryButtonTitle);

            //Commands
            bindingSet.Bind(SignupButton).To(vm => vm.SignupCommand);
            bindingSet.Bind(GoogleSignupButton).To(vm => vm.GoogleSignupCommand);
            bindingSet.Bind(ShowPasswordButton).To(vm => vm.TogglePasswordVisibilityCommand);
            bindingSet.Bind(SelectCountryButton).To(vm => vm.PickCountryCommand);
            bindingSet.Bind(LoginCard)
            .For(v => v.BindTap())
            .To(vm => vm.LoginCommand);

            //Visibility
            bindingSet.Bind(ErrorLabel)
            .For(v => v.BindAnimatedVisibility())
            .To(vm => vm.HasError);

            bindingSet.Bind(ActivityIndicator)
            .For(v => v.BindVisibilityWithFade())
            .To(vm => vm.IsLoading);

            bindingSet.Bind(PasswordTextField)
            .For(v => v.BindSecureTextEntry())
            .To(vm => vm.IsPasswordMasked);

            bindingSet.Bind(ShowPasswordButton)
            .For(v => v.BindVisible())
            .To(vm => vm.IsShowPasswordButtonVisible);

            bindingSet.Bind(PasswordTextField)
            .For(v => v.BindFirstResponder())
            .To(vm => vm.IsShowPasswordButtonVisible)
            .Mode(MvxBindingMode.OneWayToSource);

            bindingSet.Bind(CountryNotSelectedImageView)
            .For(v => v.BindAnimatedVisibility())
            .To(vm => vm.IsCountryErrorVisible);

            bindingSet.Apply();

            prepareViews();
        }
Пример #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();
            prepareOnboarding();

            var source = new StartTimeEntryTableViewSource(SuggestionsTableView);

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

            var parametricDurationConverter = new ParametricTimeSpanToDurationValueConverter();
            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 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);

            bindingSet.Bind(DescriptionTextView)
            .For(v => v.BindTextFieldInfo())
            .To(vm => vm.TextFieldInfo);

            bindingSet.Bind(TimeInput)
            .For(v => v.FormattedDuration)
            .To(vm => vm.DisplayedTime)
            .WithConversion(parametricDurationConverter, DurationFormat.Improved);

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

            bindingSet.Bind(DescriptionRemainingLengthLabel)
            .To(vm => vm.DescriptionRemainingBytes);

            //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);

            bindingSet.Bind(DoneButton)
            .For(v => v.Enabled)
            .To(vm => vm.DescriptionLengthExceeded)
            .WithConversion(invertedBoolConverter);

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

            bindingSet.Bind(DescriptionRemainingLengthLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.DescriptionLengthExceeded)
            .WithConversion(invertedVisibilityConverter);

            //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();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            if (PresentationController is ModalPresentationController modalPresentationController)
            {
                syncErrorMessageView = EditTimeEntryErrorView.Create();
                var contentView = modalPresentationController.AdditionalContentView;

                contentView.AddSubview(syncErrorMessageView);

                syncErrorMessageView.TranslatesAutoresizingMaskIntoConstraints = false;
                syncErrorMessageView.TopAnchor
                .ConstraintEqualTo(contentView.TopAnchor, 28).Active = true;
                syncErrorMessageView.LeadingAnchor
                .ConstraintEqualTo(contentView.LeadingAnchor, 8).Active = true;
                syncErrorMessageView.TrailingAnchor
                .ConstraintEqualTo(contentView.TrailingAnchor, -8).Active = true;
            }

            var durationConverter           = new TimeSpanToDurationWithUnitValueConverter();
            var dateConverter               = new DateToTitleStringValueConverter();
            var timeConverter               = new DateTimeToTimeConverter();
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var inverterVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var projectTaskClientCombiner   = new ProjectTaskClientValueCombiner(
                ProjectTaskClientLabel.Font.CapHeight,
                Color.EditTimeEntry.ClientText.ToNativeColor(),
                false
                );

            var bindingSet = this.CreateBindingSet <EditTimeEntryViewController, EditTimeEntryViewModel>();

            if (syncErrorMessageView != null)
            {
                bindingSet.Bind(syncErrorMessageView)
                .For(v => v.Text)
                .To(vm => vm.SyncErrorMessage);

                bindingSet.Bind(syncErrorMessageView)
                .For(v => v.BindTap())
                .To(vm => vm.DismissSyncErrorMessageCommand);

                bindingSet.Bind(syncErrorMessageView)
                .For(v => v.CloseCommand)
                .To(vm => vm.DismissSyncErrorMessageCommand);

                bindingSet.Bind(syncErrorMessageView)
                .For(v => v.BindVisible())
                .To(vm => vm.SyncErrorMessageVisible)
                .WithConversion(inverterVisibilityConverter);
            }

            //Text
            bindingSet.Bind(DescriptionTextField).To(vm => vm.Description);

            bindingSet.Bind(BillableSwitch)
            .For(v => v.BindAnimatedOn())
            .To(vm => vm.Billable);

            bindingSet.Bind(DurationLabel)
            .To(vm => vm.Duration)
            .WithConversion(durationConverter);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.AttributedText)
            .ByCombining(projectTaskClientCombiner,
                         v => v.Project,
                         v => v.Task,
                         v => v.Client,
                         v => v.ProjectColor);

            bindingSet.Bind(StartDateLabel)
            .To(vm => vm.StartTime)
            .WithConversion(dateConverter);

            bindingSet.Bind(StartTimeLabel)
            .To(vm => vm.StartTime)
            .WithConversion(timeConverter);

            bindingSet.Bind(TagsLabel)
            .To(vm => vm.Tags)
            .WithConversion(new CollectionToStringValueConverter <string>());

            //Commands
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(DeleteButton).To(vm => vm.DeleteCommand);
            bindingSet.Bind(ConfirmButton).To(vm => vm.ConfirmCommand);
            bindingSet.Bind(DurationLabel)
            .For(v => v.BindTap())
            .To(vm => vm.EditDurationCommand);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.BindTap())
            .To(vm => vm.SelectProjectCommand);

            bindingSet.Bind(AddProjectAndTaskView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectProjectCommand);

            bindingSet.Bind(StartDateTimeView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectStartDateTimeCommand);

            bindingSet.Bind(TagsLabel)
            .For(v => v.BindTap())
            .To(vm => vm.SelectTagsCommand);

            bindingSet.Bind(AddTagsView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectTagsCommand);

            bindingSet.Bind(BillableView)
            .For(v => v.BindTap())
            .To(vm => vm.ToggleBillableCommand);

            //Project visibility
            bindingSet.Bind(AddProjectAndTaskView)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(inverterVisibilityConverter);

            //Tags visibility
            bindingSet.Bind(AddTagsView)
            .For(v => v.BindVisible())
            .To(vm => vm.HasTags)
            .WithConversion(visibilityConverter);


            bindingSet.Bind(TagsLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.HasTags)
            .WithConversion(inverterVisibilityConverter);

            bindingSet.Apply();
        }
Пример #14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            DurationLabel.Font = DurationLabel.Font.GetMonospacedDigitFont();

            PreferredContentSize = View.Frame.Size;

            resizeSwitch();

            var durationConverter           = new TimeSpanToDurationWithUnitValueConverter();
            var dateConverter               = new DateToTitleStringValueConverter();
            var timeConverter               = new DateTimeToTimeConverter();
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var inverterVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var colorConverter              = new MvxRGBValueConverter();

            var bindingSet = this.CreateBindingSet <EditTimeEntryViewController, EditTimeEntryViewModel>();

            //Text
            bindingSet.Bind(DescriptionLabel).To(vm => vm.Description);
            bindingSet.Bind(ProjectLabel).To(vm => vm.Project);
            bindingSet.Bind(ClientLabel).To(vm => vm.Client);
            bindingSet.Bind(BillableSwitch).To(vm => vm.Billable);
            bindingSet.Bind(DurationLabel)
            .To(vm => vm.Duration)
            .WithConversion(durationConverter);

            bindingSet.Bind(StartDateLabel)
            .To(vm => vm.StartTime)
            .WithConversion(dateConverter);

            bindingSet.Bind(StartTimeLabel)
            .To(vm => vm.StartTime)
            .WithConversion(timeConverter);

            //Commands
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(DeleteButton).To(vm => vm.DeleteCommand);

            //Description visibility
            bindingSet.Bind(AddDescriptionView)
            .For(v => v.BindVisible())
            .To(vm => vm.Description)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(DescriptionLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.Description)
            .WithConversion(inverterVisibilityConverter);

            //Project visibility
            bindingSet.Bind(AddProjectAndTaskView)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(ProjectLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(inverterVisibilityConverter);

            bindingSet.Bind(ProjectDot)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(inverterVisibilityConverter);

            //Tags visibility
            bindingSet.Bind(AddTagsView)
            .For(v => v.BindVisible())
            .To(vm => vm.Tags)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(TagsLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.Tags)
            .WithConversion(inverterVisibilityConverter);

            //Colors
            bindingSet.Bind(ProjectDot)
            .For(v => v.BackgroundColor)
            .To(vm => vm.ProjectColor)
            .WithConversion(colorConverter);

            bindingSet.Apply();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            setupDismissingByTappingOnBackground();
            prepareViews();

            var durationCombiner            = new DurationValueCombiner();
            var dateCombiner                = new DateTimeOffsetDateFormatValueCombiner(TimeZoneInfo.Local);
            var timeCombiner                = new DateTimeOffsetTimeFormatValueCombiner(TimeZoneInfo.Local);
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedBoolConverter       = new BoolToConstantValueConverter <bool>(false, true);
            var inverterVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var projectTaskClientCombiner   = new ProjectTaskClientValueCombiner(
                ProjectTaskClientLabel.Font.CapHeight,
                Color.EditTimeEntry.ClientText.ToNativeColor(),
                false
                );
            var stopRunningTimeEntryAndEditDurationForStoppedConverter = new BoolToConstantValueConverter <IMvxCommand>(
                ViewModel.StopCommand, ViewModel.EditDurationCommand);

            var bindingSet = this.CreateBindingSet <EditTimeEntryViewController, EditTimeEntryViewModel>();

            //Error message view
            bindingSet.Bind(ErrorMessageLabel)
            .For(v => v.Text)
            .To(vm => vm.SyncErrorMessage);

            bindingSet.Bind(ErrorView)
            .For(v => v.BindTap())
            .To(vm => vm.DismissSyncErrorMessageCommand);

            bindingSet.Bind(ErrorView)
            .For(v => v.BindVisible())
            .To(vm => vm.SyncErrorMessageVisible)
            .WithConversion(inverterVisibilityConverter);

            //Text
            bindingSet.Bind(DescriptionTextView)
            .For(v => v.RemainingLength)
            .To(vm => vm.DescriptionRemainingLength);

            bindingSet.Bind(DescriptionTextView)
            .For(v => v.BindText())
            .To(vm => vm.Description);

            bindingSet.Bind(BillableSwitch)
            .For(v => v.BindAnimatedOn())
            .To(vm => vm.Billable);

            bindingSet.Bind(DurationLabel)
            .ByCombining(durationCombiner,
                         vm => vm.Duration,
                         vm => vm.DurationFormat);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.AttributedText)
            .ByCombining(projectTaskClientCombiner,
                         v => v.Project,
                         v => v.Task,
                         v => v.Client,
                         v => v.ProjectColor);

            bindingSet.Bind(StartDateLabel)
            .ByCombining(dateCombiner,
                         vm => vm.StartTime,
                         vm => vm.DateFormat);

            bindingSet.Bind(StartTimeLabel)
            .ByCombining(timeCombiner,
                         vm => vm.StartTime,
                         vm => vm.TimeFormat);

            bindingSet.Bind(EndTimeLabel)
            .ByCombining(timeCombiner,
                         vm => vm.StopTime,
                         vm => vm.TimeFormat);

            //Commands
            bindingSet.Bind(CloseButton).To(vm => vm.CloseCommand);
            bindingSet.Bind(DeleteButton).To(vm => vm.DeleteCommand);
            bindingSet.Bind(ConfirmButton).To(vm => vm.ConfirmCommand);

            bindingSet.Bind(DurationView)
            .For(v => v.BindTap())
            .To(vm => vm.EditDurationCommand);

            bindingSet.Bind(StartTimeView)
            .For(v => v.BindTap())
            .To(vm => vm.EditDurationCommand);

            bindingSet.Bind(StopButton)
            .To(vm => vm.StopCommand);

            bindingSet.Bind(EndTimeView)
            .For(v => v.BindTap())
            .To(vm => vm.IsTimeEntryRunning)
            .WithConversion(stopRunningTimeEntryAndEditDurationForStoppedConverter);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.BindTap())
            .To(vm => vm.SelectProjectCommand);

            bindingSet.Bind(AddProjectAndTaskView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectProjectCommand);

            bindingSet.Bind(StartDateView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectStartDateCommand);

            bindingSet.Bind(TagsTextView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectTagsCommand);

            bindingSet.Bind(AddTagsView)
            .For(v => v.BindTap())
            .To(vm => vm.SelectTagsCommand);

            bindingSet.Bind(BillableView)
            .For(v => v.BindTap())
            .To(vm => vm.ToggleBillableCommand);

            //End time and the stop button visibility
            bindingSet.Bind(StopButton)
            .For(v => v.BindVisible())
            .To(vm => vm.IsTimeEntryRunning)
            .WithConversion(inverterVisibilityConverter);

            bindingSet.Bind(EndTimeLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.IsTimeEntryRunning)
            .WithConversion(visibilityConverter);

            //Project visibility
            bindingSet.Bind(AddProjectAndTaskView)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(ProjectTaskClientLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.Project)
            .WithConversion(inverterVisibilityConverter);

            //Tags visibility
            bindingSet.Bind(AddTagsView)
            .For(v => v.BindVisible())
            .To(vm => vm.HasTags)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(TagsTextView)
            .For(v => v.BindVisible())
            .To(vm => vm.HasTags)
            .WithConversion(inverterVisibilityConverter);

            //Confirm button enabled
            bindingSet.Bind(ConfirmButton)
            .For(v => v.Enabled)
            .To(vm => vm.DescriptionLimitExceeded)
            .WithConversion(invertedBoolConverter);

            bindingSet.Bind(ConfirmButton)
            .For(v => v.Alpha)
            .To(vm => vm.DescriptionLimitExceeded)
            .WithConversion(new BoolToConstantValueConverter <nfloat>(0.5f, 1));

            bindingSet.Bind(BillableView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsBillableAvailable)
            .WithConversion(visibilityConverter);

            bindingSet.Apply();
        }
Пример #16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            UIKeyboard.Notifications.ObserveWillShow(keyboardWillShow);
            UIKeyboard.Notifications.ObserveWillHide(keyboardWillHide);

            var source = new StartTimeEntryTableViewSource(SuggestionsTableView);

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

            var timeSpanConverter           = new TimeSpanToDurationValueConverter();
            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 bindingSet = this.CreateBindingSet <StartTimeEntryViewController, StartTimeEntryViewModel>();

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

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

            bindingSet.Bind(source)
            .For(v => v.SelectionChangedCommand)
            .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);

            //Text
            bindingSet.Bind(TimeLabel)
            .To(vm => vm.ElapsedTime)
            .WithConversion(timeSpanConverter);

            bindingSet.Bind(DescriptionTextView)
            .For(v => v.BindTextFieldInfo())
            .To(vm => vm.TextFieldInfo);

            bindingSet.Bind(DescriptionRemainingLengthLabel)
            .To(vm => vm.DescriptionRemainingBytes);

            //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);

            bindingSet.Bind(DurationButton)
            .For(v => v.TintColor)
            .To(vm => vm.IsEditingDuration)
            .WithConversion(buttonColorConverter);

            bindingSet.Bind(DateTimeButton)
            .For(v => v.TintColor)
            .To(vm => vm.IsEditingStartDate)
            .WithConversion(buttonColorConverter);

            bindingSet.Bind(DoneButton)
            .For(v => v.Enabled)
            .To(vm => vm.DescriptionLengthExceeded)
            .WithConversion(invertedBoolConverter);

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

            bindingSet.Bind(DescriptionRemainingLengthLabel)
            .For(v => v.BindVisible())
            .To(vm => vm.DescriptionLengthExceeded)
            .WithConversion(invertedVisibilityConverter);

            //Commands
            bindingSet.Bind(DoneButton).To(vm => vm.DoneCommand);
            bindingSet.Bind(CloseButton).To(vm => vm.BackCommand);
            bindingSet.Bind(DurationButton).To(vm => vm.ChangeDurationCommand);
            bindingSet.Bind(BillableButton).To(vm => vm.ToggleBillableCommand);
            bindingSet.Bind(DateTimeButton).To(vm => vm.ChangeStartTimeCommand);
            bindingSet.Bind(TagsButton).To(vm => vm.ToggleTagSuggestionsCommand);
            bindingSet.Bind(ProjectsButton).To(vm => vm.ToggleProjectSuggestionsCommand);

            bindingSet.Apply();
        }
Пример #17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            PageControl.Pages    = ViewModel.NumberOfPages;
            FirstPageLabel.Text  = Resources.OnboardingTrackPageCopy;
            SecondPageLabel.Text = Resources.OnboardingLogPageCopy;
            ThirdPageLabel.Text  = Resources.OnboardingSummaryPageCopy;

            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var colorConverter = new MvxNativeColorValueConverter();
            var bindingSet     = this.CreateBindingSet <OnboardingViewController, OnboardingViewModel>();

            //Commands
            bindingSet.Bind(Skip).To(vm => vm.SkipCommand);
            bindingSet.Bind(Next).To(vm => vm.NextCommand);
            bindingSet.Bind(Login).To(vm => vm.LoginCommand);
            bindingSet.Bind(SignUp).To(vm => vm.SignUpCommand);
            bindingSet.Bind(Previous).To(vm => vm.PreviousCommand);

            //Color
            bindingSet.Bind(View)
            .For(v => v.BindAnimatedBackground())
            .To(vm => vm.BackgroundColor)
            .WithConversion(colorConverter);

            bindingSet.Bind(PhoneFrame)
            .For(v => v.BindAnimatedBackground())
            .To(vm => vm.BorderColor)
            .WithConversion(colorConverter);

            //Visibility
            bindingSet.Bind(PhoneContents)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(LastPageItems)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(Next)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(ScrollView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(Skip)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(Previous)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsFirstPage)
            .WithConversion(invertedVisibilityConverter);

            //Current Page
            bindingSet.Bind(ScrollView)
            .For(v => v.BindCurrentPage())
            .To(vm => vm.CurrentPage);

            bindingSet.Bind(PageControl)
            .For(v => v.CurrentPage)
            .To(vm => vm.CurrentPage);

            bindingSet.Apply();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //TableView config
            var source = new TimeEntriesLogViewSource(TimeEntriesTableView);

            TimeEntriesTableView.Source = source;

            //Add negative bottom inset, so that footers won't stick to the bottom of the screen
            var bottomContentInset = -source.GetHeightForFooter(TimeEntriesTableView, 0);

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                var bottomSafeAreaInset = UIApplication.SharedApplication.KeyWindow.SafeAreaInsets.Bottom;
                bottomContentInset -= bottomSafeAreaInset;
            }
            var tableViewContentInset = TimeEntriesTableView.ContentInset;

            tableViewContentInset.Bottom      = bottomContentInset;
            TimeEntriesTableView.ContentInset = tableViewContentInset;

            //Converters
            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();

            var bindingSet = this.CreateBindingSet <TimeEntriesLogViewController, TimeEntriesLogViewModel>();

            //Text
            bindingSet.Bind(EmptyStateTextLabel).To(vm => vm.EmptyStateText);
            bindingSet.Bind(EmptyStateTitleLabel).To(vm => vm.EmptyStateTitle);

            //Time entries log
            bindingSet.Bind(source).To(vm => vm.TimeEntries);

            //Visibility
            bindingSet.Bind(EmptyStateView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(TimeEntriesTableView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsEmpty)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(EmptyStateImageView)
            .For(v => v.BindVisibility())
            .To($"{nameof(TimeEntriesLogViewModel.IsEmpty)}&&!{nameof(TimeEntriesLogViewModel.IsWelcome)}")
            .WithConversion(visibilityConverter);

            bindingSet.Bind(WelcomeImageView)
            .For(v => v.BindVisibility())
            .To($"{nameof(TimeEntriesLogViewModel.IsEmpty)}&&{nameof(TimeEntriesLogViewModel.IsWelcome)}")
            .WithConversion(visibilityConverter);

            //Commands
            bindingSet.Bind(source)
            .For(s => s.SelectionChangedCommand)
            .To(vm => vm.EditCommand);

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


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

            bindingSet.Apply();
        }
Пример #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            preparePlaceholders();

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                var navigationBarHeight = NavigationController.NavigationBar.Frame.Height;
                AdditionalSafeAreaInsets = new UIEdgeInsets(-navigationBarHeight, 0, 0, 0);
            }

            PageControl.Pages    = ViewModel.NumberOfPages;
            FirstPageLabel.Text  = Resources.OnboardingTrackPageCopy;
            SecondPageLabel.Text = Resources.OnboardingMostUsedPageCopy;
            ThirdPageLabel.Text  = Resources.OnboardingReportsPageCopy;

            var visibilityConverter         = new MvxVisibilityValueConverter();
            var invertedVisibilityConverter = new MvxInvertedVisibilityValueConverter();
            var colorConverter = new MvxNativeColorValueConverter();
            var bindingSet     = this.CreateBindingSet <OnboardingViewController, OnboardingViewModel>();

            var pagedBackgroundImageColorConverter = new PaginationValueConverter <UIImage>(new[]
            {
                UIImage.FromBundle("bgNoiseBlue"),
                UIImage.FromBundle("bgNoisePurple"),
                UIImage.FromBundle("bgNoiseYellow"),
                UIImage.FromBundle("bgNoiseBlue")
            });

            //Commands
            bindingSet.Bind(Skip).To(vm => vm.SkipCommand);
            bindingSet.Bind(Next).To(vm => vm.NextCommand);
            bindingSet.Bind(Login).To(vm => vm.LoginCommand);
            bindingSet.Bind(SignUp).To(vm => vm.SignUpCommand);
            bindingSet.Bind(Previous).To(vm => vm.PreviousCommand);

            //Color
            bindingSet.Bind(View)
            .For(v => v.BindAnimatedBackground())
            .To(vm => vm.BackgroundColor)
            .WithConversion(colorConverter);

            bindingSet.Bind(PhoneFrame)
            .For(v => v.BindAnimatedBackground())
            .To(vm => vm.BorderColor)
            .WithConversion(colorConverter);

            //Noise image
            bindingSet.Bind(BackgroundImage)
            .For(v => v.BindAnimatedImage())
            .To(vm => vm.CurrentPage)
            .WithConversion(pagedBackgroundImageColorConverter);

            //Visibility
            bindingSet.Bind(PhoneContents)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(LastPageItems)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(Next)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(ScrollView)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(Skip)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsLastPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(Previous)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsFirstPage)
            .WithConversion(invertedVisibilityConverter);

            bindingSet.Bind(trackPagePlaceholder)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsTrackPage)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(mostUsedPagePlaceholder)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsMostUsedPage)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(reportsPagePlaceholder)
            .For(v => v.BindVisibility())
            .To(vm => vm.IsSummaryPage)
            .WithConversion(visibilityConverter);


            //Current Page
            bindingSet.Bind(ScrollView)
            .For(v => v.BindAnimatedCurrentPage())
            .To(vm => vm.CurrentPage);

            bindingSet.Bind(PageControl)
            .For(v => v.CurrentPage)
            .To(vm => vm.CurrentPage);

            bindingSet.Apply();
        }
Пример #20
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            source = new MainTableViewSource(TimeEntriesLogTableView);

            prepareOnboarding();

            var suggestionsView = new SuggestionsView();

            TimeEntriesLogTableView.TableHeaderView = suggestionsView;
            TimeEntriesLogTableView.Source          = source;

            suggestionsView.DataContext = ViewModel.SuggestionsViewModel;

            source.Initialize();

            var timeEntriesLogFooter = new UIView(
                new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, 64)
                );
            var colorConverter                = new MvxNativeColorValueConverter();
            var visibilityConverter           = new MvxVisibilityValueConverter();
            var parametricTimeSpanConverter   = new ParametricTimeSpanToDurationValueConverter();
            var invertedVisibilityConverter   = new MvxInvertedVisibilityValueConverter();
            var timeEntriesLogFooterConverter = new BoolToConstantValueConverter <UIView>(new UIView(), timeEntriesLogFooter);
            var projectTaskClientCombiner     = new ProjectTaskClientValueCombiner(
                CurrentTimeEntryProjectTaskClientLabel.Font.CapHeight,
                Color.Main.CurrentTimeEntryClientColor.ToNativeColor(),
                true
                );
            var startTimeEntryButtonManualModeIconConverter = new BoolToConstantValueConverter <UIImage>(
                UIImage.FromBundle("manualIcon"),
                UIImage.FromBundle("playIcon")
                );

            var bindingSet = this.CreateBindingSet <MainViewController, MainViewModel>();

            //Table view
            bindingSet.Bind(source)
            .For(v => v.ObservableCollection)
            .To(vm => vm.TimeEntriesLogViewModel.TimeEntries);

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

            bindingSet.Bind(TimeEntriesLogTableView)
            .For(v => v.TableFooterView)
            .To(vm => vm.TimeEntriesLogViewModel.IsEmpty)
            .WithConversion(timeEntriesLogFooterConverter);

            //Commands
            bindingSet.Bind(reportsButton).To(vm => vm.OpenReportsCommand);
            bindingSet.Bind(settingsButton).To(vm => vm.OpenSettingsCommand);
            bindingSet.Bind(StopTimeEntryButton).To(vm => vm.StopTimeEntryCommand);
            bindingSet.Bind(StartTimeEntryButton).To(vm => vm.StartTimeEntryCommand);
            bindingSet.Bind(EditTimeEntryButton).To(vm => vm.EditTimeEntryCommand);

            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindTap())
            .To(vm => vm.EditTimeEntryCommand);

            bindingSet.Bind(source)
            .For(v => v.SelectionChangedCommand)
            .To(vm => vm.TimeEntriesLogViewModel.EditCommand);

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

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

            bindingSet.Bind(source)
            .For(v => v.DeleteTimeEntryCommand)
            .To(vm => vm.TimeEntriesLogViewModel.DeleteCommand);

            bindingSet.Bind(suggestionsView)
            .For(v => v.SuggestionTappedCommad)
            .To(vm => vm.SuggestionsViewModel.StartTimeEntryCommand);

            //Visibility
            bindingSet.Bind(WelcomeBackView)
            .For(v => v.BindVisibility())
            .To(vm => vm.ShouldShowWelcomeBack)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(spiderContainerView)
            .For(v => v.BindVisibility())
            .To(vm => vm.ShouldShowWelcomeBack)
            .WithConversion(visibilityConverter);

            bindingSet.Bind(spiderBroView)
            .For(v => v.BindSpiderVisibility())
            .To(vm => vm.ShouldShowWelcomeBack);

            bindingSet.Bind(emptyStateView)
            .For(v => v.BindVisibility())
            .To(vm => vm.ShouldShowEmptyState)
            .WithConversion(visibilityConverter);

            //Text
            bindingSet.Bind(CurrentTimeEntryDescriptionLabel).To(vm => vm.CurrentTimeEntryDescription);
            bindingSet.Bind(CurrentTimeEntryElapsedTimeLabel)
            .To(vm => vm.CurrentTimeEntryElapsedTime)
            .WithConversion(parametricTimeSpanConverter, DurationFormat.Improved);

            bindingSet.Bind(CurrentTimeEntryProjectTaskClientLabel)
            .For(v => v.AttributedText)
            .ByCombining(projectTaskClientCombiner,
                         v => v.CurrentTimeEntryProject,
                         v => v.CurrentTimeEntryTask,
                         v => v.CurrentTimeEntryClient,
                         v => v.CurrentTimeEntryProjectColor);

            //The start button
            bindingSet.Bind(StartTimeEntryButton)
            .For(v => v.BindImage())
            .To(vm => vm.IsInManualMode)
            .WithConversion(startTimeEntryButtonManualModeIconConverter);

            bindingSet.Apply();

            View.SetNeedsLayout();
            View.LayoutIfNeeded();
        }
Пример #21
0
 public void Include(MvxInvertedVisibilityValueConverter converter)
 {
     converter.Convert(null, null, null, null);
     converter.ConvertBack(null, null, null, null);
 }