Beispiel #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            HeadingLabel.Text = Resources.NoWorries;
            MessageLabel.Text = Resources.EnableAccessLater;
            ContinueWithoutAccessButton.SetTitle(Resources.ContinueWithoutAccess, UIControlState.Normal);

            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            PreferredContentSize = new CGSize
            {
                // ScreenWidth - 32 for 16pt margins on both sides
                Width  = screenWidth > 320 ? screenWidth - 32 : 312,
                Height = cardHeight
            };

            EnableAccessButton.Rx()
            .BindAction(ViewModel.EnableAccess)
            .DisposedBy(DisposeBag);

            ContinueWithoutAccessButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(DisposeBag);
        }
        void ReleaseDesignerOutlets()
        {
            if (ContinueWithoutAccessButton != null)
            {
                ContinueWithoutAccessButton.Dispose();
                ContinueWithoutAccessButton = null;
            }

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

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

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

            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            PreferredContentSize = new CGSize
            {
                // ScreenWidth - 32 for 16pt margins on both sides
                Width  = screenWidth > 320 ? screenWidth - 32 : 312,
                Height = cardHeight
            };

            this.Bind(EnableAccessButton.Rx().Tap(), ViewModel.EnableAccessAction);
            this.Bind(ContinueWithoutAccessButton.Rx().Tap(), ViewModel.ContinueWithoutAccessAction);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            HeadingLabel.Text = Resources.NoWorries;
            MessageLabel.Text = Resources.EnableAccessLater;
            ContinueWithoutAccessButton.SetTitle(Resources.ContinueWithoutAccess, UIControlState.Normal);

            var enableAccessString = string.Format(Resources.CalendarPermissionDeniedOr, Resources.CalendarPermissionDeniedEnableButton);

            var rangeStart = enableAccessString.IndexOf(Resources.CalendarPermissionDeniedEnableButton, System.StringComparison.CurrentCulture);
            var rangeEnd   = Resources.CalendarPermissionDeniedEnableButton.Length;
            var range      = new NSRange(rangeStart, rangeEnd);

            var attributedString = new NSMutableAttributedString(
                enableAccessString,
                new UIStringAttributes {
                ForegroundColor = UIColor.Black
            });

            attributedString.AddAttributes(
                new UIStringAttributes {
                ForegroundColor = Colors.Calendar.EnableCalendarAction.ToNativeColor()
            },
                range);

            EnableAccessButton.SetAttributedTitle(attributedString, UIControlState.Normal);

            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            PreferredContentSize = new CGSize
            {
                // ScreenWidth - 32 for 16pt margins on both sides
                Width  = screenWidth > 320 ? screenWidth - 32 : 312,
                Height = cardHeight
            };

            EnableAccessButton.Rx()
            .BindAction(ViewModel.EnableAccess)
            .DisposedBy(DisposeBag);

            ContinueWithoutAccessButton.Rx().Tap()
            .Subscribe(ViewModel.CloseWithDefaultResult)
            .DisposedBy(DisposeBag);
        }