Exemplo n.º 1
0
        public RepositoriesTrendingView()
        {
            var titleButton = new TrendingTitleButton
            {
                Frame     = new CGRect(0, 0, 200f, 32f),
                TintColor = Theme.PrimaryNavigationBarTextColor
            };

            NavigationItem.TitleView   = titleButton;
            titleButton.TouchUpInside += (sender, e) => ViewModel.GoToLanguages.ExecuteIfCan();

            this.WhenAnyValue(x => x.ViewModel.SelectedLanguage).IsNotNull()
            .Subscribe(x => titleButton.Text = x.Name);

            EmptyView = new Lazy <UIView>(() =>
                                          new EmptyListView(Octicon.Pulse.ToEmptyListImage(), "There are no trending repositories."));

            Appearing
            .Where(_ => NavigationController != null)
            .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = new UIImage());

            Disappearing
            .Where(_ => NavigationController != null)
            .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = null);
        }
Exemplo n.º 2
0
        public NotificationsView()
        {
            _segmentBarButton = new UIBarButtonItem(_viewSegment);

            EmptyView = new Lazy <UIView>(() =>
                                          new EmptyListView(Octicon.Inbox.ToImage(64f), "No new notifications."));

            _markButton = new UIBarButtonItem(string.Empty, UIBarButtonItemStyle.Plain, (s, e) => ViewModel.ReadSelectedCommand.ExecuteIfCan());

            _segmentToolbar = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
            _markToolbar    = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _markButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
            ToolbarItems    = _segmentToolbar;

            _editButton   = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (s, e) => StartEditing());
            _cancelButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (s, e) => StopEditing());

            this.WhenActivated(d =>
            {
                d(this.WhenAnyValue(x => x.ViewModel.GroupedNotifications)
                  .SelectMany(x => x)
                  .SelectMany(x => x.Notifications)
                  .Select(x => x.WhenAnyValue(y => y.IsSelected))
                  .Merge()
                  .Select(_ => ViewModel.GroupedNotifications.SelectMany(x => x.Notifications).Any(x => x.IsSelected))
                  .Where(x => TableView.Editing)
                  .Subscribe(x =>
                {
                    _markButton.Title = x ? "Mark Selected as Read" : "Read All as Read";
                }));

                d(this.WhenAnyValue(x => x.ViewModel.GroupedNotifications)
                  .Where(x => x.Count == 0 && TableView.Editing)
                  .Subscribe(_ => StopEditing()));

                d(this.WhenAnyValue(x => x.ViewModel.GroupedNotifications)
                  .Subscribe(x => _editButton.Enabled = x.Count > 0));

                d(this.WhenAnyValue(x => x.ViewModel.ActiveFilter)
                  .Subscribe(x =>
                {
                    _viewSegment.SelectedSegment = x;
                    NavigationItem.SetRightBarButtonItem((_viewSegment.SelectedSegment != 2) ? _editButton : null, true);
                }));
            });

            Appearing
            .Where(_ => NavigationController != null)
            .Subscribe(x => NavigationController.SetToolbarHidden(false, x));

            Disappearing
            .Where(_ => NavigationController != null)
            .Subscribe(x => NavigationController.SetToolbarHidden(true, x));
        }
Exemplo n.º 3
0
        protected BaseDialogViewController()
            : base(UITableViewStyle.Grouped)
        {
            SlideUpTitle = new SlideUpTitleView(44f)
            {
                Offset = 100f
            };
            NavigationItem.TitleView = SlideUpTitle;
            HeaderView            = new ImageAndTitleHeaderView();
            _backgroundHeaderView = new UIView();

            Appearing
            .Where(x => ToolbarItems != null && NavigationController != null)
            .Subscribe(x => NavigationController.SetToolbarHidden(false, x));
            Disappearing
            .Where(x => ToolbarItems != null && NavigationController != null)
            .Subscribe(x => NavigationController.SetToolbarHidden(true, x));
            Disappearing
            .Where(_ => NavigationController != null)
            .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = null);
        }