예제 #1
0
        public LockScreenView(RectangleF frame) : base(frame)
        {
            SetDefaultStyles();
            var height = frame.Size.Height >= 568.0f ? 568.0f : frame.Size.Height;

            ContentView = new UIView(new RectangleF(0, 0, 320, height));
            ContentView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin |
                                           UIViewAutoresizing.FlexibleTopMargin |
                                           UIViewAutoresizing.FlexibleRightMargin |
                                           UIViewAutoresizing.FlexibleBottomMargin;
            ContentView.Center = this.Center;
            AddSubview(ContentView);

            RequiresRotationCorrection = false;

            EnterPasscodeLabel      = StandardLabel();
            DigitsTextField         = new UITextField(Rectangle.Empty);
            EnterPasscodeLabel.Text = "Enter Passcode".Translate();
            DetailLabel             = StandardLabel();
            ButtonOne   = new LockButton(RectangleF.Empty, 1, string.Empty);
            ButtonTwo   = new LockButton(RectangleF.Empty, 2, "ABC");
            ButtonThree = new LockButton(RectangleF.Empty, 3, "DEF");

            ButtonFour = new LockButton(RectangleF.Empty, 4, "GHI");
            ButtonFive = new LockButton(RectangleF.Empty, 5, "JKL");
            ButtonSix  = new LockButton(RectangleF.Empty, 6, "MNO");

            ButtonSeven = new LockButton(RectangleF.Empty, 7, "PQRS");
            ButtonEight = new LockButton(RectangleF.Empty, 8, "TUV");
            ButtonNine  = new LockButton(RectangleF.Empty, 9, "WXYZ");

            ButtonZero = new LockButton(RectangleF.Empty, 0, string.Empty);

            var buttonType = UIButtonType.System;

            if (IsLessThanIOS6)
            {
                buttonType = UIButtonType.Custom;
            }
            CancelButton = UIButton.FromType(buttonType);
            CancelButton.SetTitle("Cancel".Translate(), UIControlState.Normal);
            CancelButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;

            DeleteButton = UIButton.FromType(buttonType);
            DeleteButton.SetTitle("Delete".Translate(), UIControlState.Normal);
            DeleteButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            DeleteButton.Alpha = 0.0f;

            OkButton = UIButton.FromType(buttonType);
            OkButton.SetTitle("OK".Translate(), UIControlState.Normal);
            OkButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            OkButton.Alpha = 0.0f;

            IsComplexPin = false;
        }
예제 #2
0
 private void InitialiseAllStrings()
 {
     ModifySeekiosImageButton.SetTitle(Application.LocalizedString("ModifyImage"), UIControlState.Normal);
     SeekiosNameLabel.Text            = Application.LocalizedString("SeekiosName");
     SeekiosNameTextField.Placeholder = Application.LocalizedString("MyNameIs");
     IMEILabel.Text = Application.LocalizedString("IMEINumber");
     SeekiosIMEITextField.Placeholder = Application.LocalizedString("IMEIPlaceholder");
     PinLabel.Text = Application.LocalizedString("PinCode");
     SeekiosPinCodeTextField.Placeholder = Application.LocalizedString("PinPlaceholder");
     SaveButton.SetTitle(Application.LocalizedString("Save"), UIControlState.Normal);
     DeleteButton.SetTitle(Application.LocalizedString("Delete"), UIControlState.Normal);
     NotificationTrackingLabel.Text = Application.LocalizedString("NotificationNewLocationTracking");
     NotificationZoneLabel.Text     = Application.LocalizedString("NotificationNewLocationOutOfZone");
     NotificationDontMoveLabel.Text = Application.LocalizedString("NotificationNewLocationMoved");
 }
예제 #3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            Name.Text  = item.Name;
            Notes.Text = item.Notes;
            Done.On    = item.Done;

            if (item.ID <= 0)
            {
                DeleteButton.SetTitle("Cancel", UIControlState.Normal);
            }
            else
            {
                DeleteButton.SetTitle("Delete", UIControlState.Normal);
            }
        }
        private void localizeLabels()
        {
            TitleLabel.Text = ViewModel.IsEditingGroup
                ? string.Format(Resources.EditingTimeEntryGroup, ViewModel.GroupCount)
                : 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);
        }
        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);
            }
        }