Ejemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = Resources.SiriShortcuts;

            DescriptionLabel.Text = Resources.SiriShortcutsDescription;
            HeaderView.RemoveFromSuperview();
            TableView.TableHeaderView = HeaderView;
            HeaderView.TranslatesAutoresizingMaskIntoConstraints = false;
            HeaderView.WidthAnchor.ConstraintEqualTo(TableView.WidthAnchor).Active = true;

            HeaderView.InsertSeparator();

            TableView.TableFooterView = new UIView();

            var tableViewSource = new SiriShortcutsTableViewSource(TableView);

            TableView.Source = tableViewSource;

            refreshSubject
            .SelectMany(getAllShortcuts())
            .SelectMany(toViewModels)
            .Select(toSections)
            .ObserveOn(new NSRunloopScheduler())
            .Subscribe(TableView.Rx().ReloadSections(tableViewSource))
            .DisposedBy(DisposeBag);

            tableViewSource.Rx().ModelSelected()
            .Subscribe(handleShortcutTap)
            .DisposedBy(DisposeBag);
        }