Пример #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareSiriButton();

            NavigationItem.Title          = Resources.ReportPeriod;
            SelectWorkspaceCellLabel.Text = Resources.SelectWorkspace;

            TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            TableView.RegisterNibForCellReuse(SiriShortcutReportPeriodCell.Nib, SiriShortcutReportPeriodCell.Identifier);

            TableView.RowHeight       = rowHeight;
            TableView.TableFooterView = TableFooterView;

            var source =
                new CustomTableViewSource <ReportSection, Unit,
                                           SelectableReportPeriodViewModel>(
                    SiriShortcutReportPeriodCell.CellConfiguration(SiriShortcutReportPeriodCell.Identifier)
                    );

            ViewModel.ReportPeriods
            .Subscribe(TableView.Rx().ReloadItems(source))
            .DisposedBy(DisposeBag);

            source.Rx().ModelSelected()
            .Select(p => p.ReportPeriod)
            .Subscribe(ViewModel.SelectReportPeriod.Accept)
            .DisposedBy(DisposeBag);

            TableView.Source = source;

            SelectWorkspaceView.Rx()
            .BindAction(ViewModel.PickWorkspace)
            .DisposedBy(DisposeBag);

            ViewModel.WorkspaceName
            .Subscribe(SelectWorkspaceNameLabel.Rx().Text())
            .DisposedBy(DisposeBag);
        }
        void ReleaseDesignerOutlets()
        {
            if (AddToSiriWrapperView != null)
            {
                AddToSiriWrapperView.Dispose();
                AddToSiriWrapperView = null;
            }

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

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

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

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

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