void ReleaseDesignerOutlets() { if (DescriptionLabel != null) { DescriptionLabel.Dispose(); DescriptionLabel = null; } if (ProjectDot != null) { ProjectDot.Dispose(); ProjectDot = null; } if (ProjectLabel != null) { ProjectLabel.Dispose(); ProjectLabel = null; } if (ClientLabel != null) { ClientLabel.Dispose(); ClientLabel = null; } if (FadeView != null) { FadeView.Dispose(); FadeView = null; } }
public override void AwakeFromNib() { base.AwakeFromNib(); FadeView.FadeRight = true; this.DelayBind(() => { var colorConverter = new MvxRGBValueConverter(); var durationCombiner = new DurationValueCombiner(); var visibilityConverter = new MvxVisibilityValueConverter(); var bindingSet = this.CreateBindingSet <ReportsLegendViewCell, ChartSegment>(); ProjectLabel.SetKerning(-0.2); ClientLabel.SetKerning(-0.2); TotalTimeLabel.SetKerning(-0.2); PercentageLabel.SetKerning(-0.2); //Text bindingSet.Bind(ProjectLabel).To(vm => vm.ProjectName); bindingSet.Bind(ClientLabel).To(vm => vm.ClientName); bindingSet.Bind(PercentageLabel) .For(v => v.Text) .ByCombining("Format", "'{0:0.00}%'", nameof(ChartSegment.Percentage)); bindingSet.Bind(TotalTimeLabel) .ByCombining(durationCombiner, vm => vm.TrackedTime, vm => vm.DurationFormat); bindingSet.Bind(ClientLabel) .For(v => v.BindVisibility()) .To(vm => vm.HasClient) .WithConversion(visibilityConverter); // Color bindingSet.Bind(ProjectLabel) .For(v => v.TextColor) .To(vm => vm.Color) .WithConversion(colorConverter); bindingSet.Bind(CircleView) .For(v => v.BackgroundColor) .To(vm => vm.Color) .WithConversion(colorConverter); bindingSet.Apply(); }); }
protected override void UpdateView() { ProjectLabel.SetKerning(-0.2); ClientLabel.SetKerning(-0.2); TotalTimeLabel.SetKerning(-0.2); PercentageLabel.SetKerning(-0.2); //Text ProjectLabel.Text = Item.ProjectName; ClientLabel.Text = Item.ClientName; PercentageLabel.Text = $"{Item.Percentage:F2}%"; TotalTimeLabel.Text = Item.TrackedTime.ToFormattedString(Item.DurationFormat); ClientLabel.Hidden = !Item.HasClient; // Color var color = new Color(Item.Color).ToNativeColor(); ProjectLabel.TextColor = color; CircleView.BackgroundColor = color; }
void ReleaseDesignerOutlets() { if (CircleView != null) { CircleView.Dispose(); CircleView = null; } if (PercentageLabel != null) { PercentageLabel.Dispose(); PercentageLabel = null; } if (ProjectLabel != null) { ProjectLabel.Dispose(); ProjectLabel = null; } if (ClientLabel != null) { ClientLabel.Dispose(); ClientLabel = null; } if (TotalTimeLabel != null) { TotalTimeLabel.Dispose(); TotalTimeLabel = null; } if (FadeView != null) { FadeView.Dispose(); FadeView = null; } }
void ReleaseDesignerOutlets() { if (ClientLabel != null) { ClientLabel.Dispose(); ClientLabel = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (ColorCircleView != null) { ColorCircleView.Dispose(); ColorCircleView = null; } if (ColorPickerOpeningView != null) { ColorPickerOpeningView.Dispose(); ColorPickerOpeningView = null; } if (DoneButton != null) { DoneButton.Dispose(); DoneButton = null; } if (ErrorLabel != null) { ErrorLabel.Dispose(); ErrorLabel = null; } if (NameTextField != null) { NameTextField.Dispose(); NameTextField = null; } if (PrivateProjectSwitch != null) { PrivateProjectSwitch.Dispose(); PrivateProjectSwitch = null; } if (PrivateProjectSwitchContainer != null) { PrivateProjectSwitchContainer.Dispose(); PrivateProjectSwitchContainer = null; } if (ProjectNameUsedErrorTextHeight != null) { ProjectNameUsedErrorTextHeight.Dispose(); ProjectNameUsedErrorTextHeight = null; } if (ProjectNameUsedErrorView != null) { ProjectNameUsedErrorView.Dispose(); ProjectNameUsedErrorView = null; } if (TemplateLabel != null) { TemplateLabel.Dispose(); TemplateLabel = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (WorkspaceLabel != null) { WorkspaceLabel.Dispose(); WorkspaceLabel = null; } if (PrivateProjectLabel != null) { PrivateProjectLabel.Dispose(); PrivateProjectLabel = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); TitleLabel.Text = Resources.NewProject; NameTextField.Placeholder = Resources.ProjectName; ErrorLabel.Text = Resources.ProjectNameTakenError; DoneButton.SetTitle(Resources.Create, UIControlState.Normal); ProjectNameUsedErrorTextHeight.Constant = 0; // Name NameTextField.Rx().Text() .Subscribe(ViewModel.Name.Accept) .DisposedBy(DisposeBag); ViewModel.Name .Subscribe(NameTextField.Rx().TextObserver()) .DisposedBy(DisposeBag); // Color ColorPickerOpeningView.Rx() .BindAction(ViewModel.PickColor) .DisposedBy(DisposeBag); ViewModel.Color .Select(color => color.ToNativeColor()) .Subscribe(ColorCircleView.Rx().BackgroundColor()) .DisposedBy(DisposeBag); // Error ViewModel.Error .Subscribe(ErrorLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Error .Select(e => string.IsNullOrEmpty(e) ? new nfloat(0) : errorVisibleHeight) .Subscribe(ProjectNameUsedErrorTextHeight.Rx().Constant()) .DisposedBy(DisposeBag); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { ViewModel.Error .Select(e => string.IsNullOrEmpty(e) ? desiredIpadHeight : errorVisibleHeight + desiredIpadHeight) .Select(h => new CGSize(0, h)) .Subscribe(this.Rx().PreferredContentSize()) .DisposedBy(DisposeBag); } // Workspace WorkspaceLabel.Rx() .BindAction(ViewModel.PickWorkspace) .DisposedBy(DisposeBag); ViewModel.WorkspaceName .Subscribe(WorkspaceLabel.Rx().Text()) .DisposedBy(DisposeBag); // Client ClientLabel.Rx() .BindAction(ViewModel.PickClient) .DisposedBy(DisposeBag); var emptyText = Resources.AddClient.PrependWithAddIcon(ClientLabel.Font.CapHeight); ViewModel.ClientName .Select(attributedClientName) .Subscribe(ClientLabel.Rx().AttributedText()) .DisposedBy(DisposeBag); // Is Private PrivateProjectSwitchContainer.Rx().Tap() .Select(_ => PrivateProjectSwitch.On) .Subscribe(ViewModel.IsPrivate.Accept) .DisposedBy(DisposeBag); ViewModel.IsPrivate .Subscribe(PrivateProjectSwitch.Rx().On()) .DisposedBy(DisposeBag); // Save DoneButton.Rx() .BindAction(ViewModel.Save) .DisposedBy(DisposeBag); CloseButton.Rx() .BindAction(ViewModel.Close) .DisposedBy(DisposeBag); NSAttributedString attributedClientName(string clientName) { if (string.IsNullOrEmpty(clientName)) { return(emptyText); } return(new NSAttributedString(clientName)); } }
void ReleaseDesignerOutlets() { if (ClientLabel != null) { ClientLabel.Dispose(); ClientLabel = null; } if (AddDescriptionView != null) { AddDescriptionView.Dispose(); AddDescriptionView = null; } 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 (DescriptionLabel != null) { DescriptionLabel.Dispose(); DescriptionLabel = null; } if (DurationLabel != null) { DurationLabel.Dispose(); DurationLabel = null; } if (ProjectDot != null) { ProjectDot.Dispose(); ProjectDot = null; } if (ProjectLabel != null) { ProjectLabel.Dispose(); ProjectLabel = null; } if (StartDateLabel != null) { StartDateLabel.Dispose(); StartDateLabel = null; } if (StartTimeLabel != null) { StartTimeLabel.Dispose(); StartTimeLabel = null; } if (TagsLabel != null) { TagsLabel.Dispose(); TagsLabel = null; } }