Example #1
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityIndicatorView != null)
            {
                ActivityIndicatorView.Dispose();
                ActivityIndicatorView = null;
            }

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

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

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

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

            CreateWorkspaceButton.SetTitle(Resources.CreateNewWorkspace, UIControlState.Normal);
            HeadingLabel.Text = Resources.UhOh;
            TextLabel.Text    = Resources.NoWorkspaceErrorMessage;

            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
            };

            prepareViews();

            CreateWorkspaceButton.Rx()
            .BindAction(ViewModel.CreateWorkspaceWithDefaultName)
            .DisposedBy(DisposeBag);

            TryAgainButton.Rx()
            .BindAction(ViewModel.TryAgain)
            .DisposedBy(DisposeBag);

            ViewModel.IsLoading
            .Invert()
            .Subscribe(CreateWorkspaceButton.Rx().Enabled())
            .DisposedBy(DisposeBag);

            ViewModel.IsLoading
            .Invert()
            .Subscribe(TryAgainButton.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            ViewModel.IsLoading.StartWith(false)
            .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);
        }
        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
            };

            prepareViews();

            this.Bind(CreateWorkspaceButton.Rx().Tap(), ViewModel.CreateWorkspaceWithDefaultName);
            this.Bind(TryAgainButton.Rx().Tap(), ViewModel.TryAgain);

            this.Bind(ViewModel.IsLoading.Select(CommonFunctions.Invert), CreateWorkspaceButton.Rx().Enabled());
            this.Bind(ViewModel.IsLoading.Select(CommonFunctions.Invert), TryAgainButton.Rx().IsVisibleWithFade());
            this.Bind(ViewModel.IsLoading.StartWith(false), ActivityIndicatorView.Rx().IsVisibleWithFade());
        }
 private void prepareViews()
 {
     ActivityIndicatorView.IndicatorColor = Color.NoWorkspace.ActivityIndicator.ToNativeColor();
     CreateWorkspaceButton.SetTitleColor(Color.NoWorkspace.DisabledCreateWorkspaceButton.ToNativeColor(), UIControlState.Disabled);
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CreateWorkspaceButton.SetTitle(Resources.CreateNewWorkspace, UIControlState.Normal);
            HeadingLabel.Text = Resources.UhOh;
            TextLabel.Text    = Resources.NoWorkspaceErrorMessage;

            var tryAgainString = string.Format(Resources.NoWorkspaceOr, Resources.NoWorkspaceTryAgain);

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

            var attributedString = new NSMutableAttributedString(
                tryAgainString,
                new UIStringAttributes {
                ForegroundColor = ColorAssets.Text
            });

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

            TryAgainButton.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
            };

            prepareViews();

            CreateWorkspaceButton.Rx()
            .BindAction(ViewModel.CreateWorkspaceWithDefaultName)
            .DisposedBy(DisposeBag);

            TryAgainButton.Rx()
            .BindAction(ViewModel.TryAgain)
            .DisposedBy(DisposeBag);

            ViewModel.IsLoading
            .Invert()
            .Subscribe(CreateWorkspaceButton.Rx().Enabled())
            .DisposedBy(DisposeBag);

            ViewModel.IsLoading
            .Invert()
            .Subscribe(TryAgainButton.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            ViewModel.IsLoading.StartWith(false)
            .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);
        }
 private void prepareViews()
 {
     ActivityIndicatorView.TintColor = Color.NoWorkspace.ActivityIndicator.ToNativeColor();
     ActivityIndicatorView.Image     = ActivityIndicatorView.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
     CreateWorkspaceButton.SetTitleColor(Color.NoWorkspace.DisabledCreateWorkspaceButton.ToNativeColor(), UIControlState.Disabled);
 }