void ReleaseDesignerOutlets()
        {
            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

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

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

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

            if (EmptyStateImage != null)
            {
                EmptyStateImage.Dispose();
                EmptyStateImage = null;
            }
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var tableViewSource = new SelectTagsTableViewSource(TagsTableView);

            tableViewSource.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectTag.Inputs)
            .DisposedBy(DisposeBag);

            var tagsReplay = ViewModel.Tags.Replay();

            tagsReplay
            .Subscribe(TagsTableView.Rx().ReloadItems(tableViewSource))
            .DisposedBy(DisposeBag);

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                tagsReplay
                .Select((tags) =>
                {
                    var count         = tags.ToList().Count();
                    var contentHeight = count > 0
                            ? count * SelectTagsTableViewSource.RowHeight
                            : placeholderHeight;
                    return(new CoreGraphics.CGSize(0, contentHeight + headerHeight));
                })
                .Subscribe(this.Rx().PreferredContentSize())
                .DisposedBy(DisposeBag);
            }

            tagsReplay.Connect();

            ViewModel.IsEmpty
            .Subscribe(EmptyStateImage.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.FilterText
            .Subscribe(TextField.Rx().TextObserver())
            .DisposedBy(DisposeBag);

            CloseButton.Rx().Tap()
            .Subscribe(ViewModel.CloseWithDefaultResult)
            .DisposedBy(DisposeBag);

            SaveButton.Rx()
            .BindAction(ViewModel.Save)
            .DisposedBy(DisposeBag);

            TextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            BottomConstraint.Active |= UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Pad;
        }
Ejemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CloseButton.SetTemplateColor(ColorAssets.Text2);

            SearchView.InsertSeparator();

            TitleLabel.Text       = Resources.Tags;
            TextField.Placeholder = Resources.AddFilterTags;
            EmptyStateLabel.Text  = Resources.EmptyTagText;
            SaveButton.SetTitle(Resources.Save, UIControlState.Normal);

            var tableViewSource = new SelectTagsTableViewSource(TagsTableView);

            tableViewSource.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectTag.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.Rx().DragStarted()
            .Subscribe(_ => TextField.ResignFirstResponder())
            .DisposedBy(DisposeBag);

            var tagsReplay = ViewModel.Tags.Replay();

            tagsReplay
            .Subscribe(TagsTableView.Rx().ReloadItems(tableViewSource))
            .DisposedBy(DisposeBag);

            tagsReplay.Connect();

            ViewModel.IsEmpty
            .Subscribe(EmptyStateImage.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.FilterText
            .Subscribe(TextField.Rx().TextObserver())
            .DisposedBy(DisposeBag);

            CloseButton.Rx().Tap()
            .Subscribe(() => ViewModel.CloseWithDefaultResult())
            .DisposedBy(DisposeBag);

            SaveButton.Rx()
            .BindAction(ViewModel.Save)
            .DisposedBy(DisposeBag);

            TextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            BottomConstraint.Active |= TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Compact;
        }
        void ReleaseDesignerOutlets()
        {
            if (BottomConstraint != null)
            {
                BottomConstraint.Dispose();
                BottomConstraint = null;
            }

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

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

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

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

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

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

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

            if (SearchView != null)
            {
                SearchView.Dispose();
                SearchView = null;
            }
        }
Ejemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CloseButton.SetTemplateColor(ColorAssets.Text2);

            SearchView.InsertSeparator();

            TitleLabel.Text      = Resources.Projects;
            EmptyStateLabel.Text = Resources.EmptyProjectText;

            var source = new SelectProjectTableViewSource();

            source.RegisterViewCells(ProjectsTableView);

            source.UseGrouping = ViewModel.UseGrouping;

            ProjectsTableView.TableFooterView = new UIView();
            ProjectsTableView.Source          = source;

            source.Rx().DragStarted()
            .Subscribe(_ => TextField.ResignFirstResponder())
            .DisposedBy(DisposeBag);

            ViewModel.Suggestions
            .Subscribe(ProjectsTableView.Rx().ReloadSections(source))
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateImage.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PlaceholderText
            .Subscribe(TextField.Rx().PlaceholderText())
            .DisposedBy(DisposeBag);

            TextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            CloseButton.Rx().Tap()
            .Subscribe(() => ViewModel.CloseWithDefaultResult())
            .DisposedBy(DisposeBag);

            source.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectProject.Inputs)
            .DisposedBy(DisposeBag);

            source.ToggleTaskSuggestions
            .Subscribe(ViewModel.ToggleTaskSuggestions.Inputs)
            .DisposedBy(DisposeBag);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new SelectProjectTableViewSource();

            source.RegisterViewCells(ProjectsTableView);

            source.UseGrouping = ViewModel.UseGrouping;

            ProjectsTableView.TableFooterView = new UIView();
            ProjectsTableView.Source          = source;

            ViewModel.Suggestions
            .Subscribe(ProjectsTableView.Rx().ReloadSections(source))
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateImage.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PlaceholderText
            .Subscribe(TextField.Rx().PlaceholderText())
            .DisposedBy(DisposeBag);

            TextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            CloseButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(DisposeBag);

            source.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectProject.Inputs)
            .DisposedBy(DisposeBag);

            source.ToggleTaskSuggestions
            .Subscribe(ViewModel.ToggleTaskSuggestions.Inputs)
            .DisposedBy(DisposeBag);

            TextField.BecomeFirstResponder();
        }
Ejemplo n.º 7
0
        void ReleaseDesignerOutlets()
        {
            if (DownloadTableView != null)
            {
                DownloadTableView.Dispose();
                DownloadTableView = null;
            }

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

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

            var tableViewSource = new SelectTagsTableViewSource(TagsTableView);

            tableViewSource.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectTag.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.Tags
            .Subscribe(TagsTableView.Rx().ReloadItems(tableViewSource))
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateImage.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.FilterText
            .Subscribe(TextField.Rx().TextObserver())
            .DisposedBy(DisposeBag);

            CloseButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(DisposeBag);

            SaveButton.Rx()
            .BindAction(ViewModel.Save)
            .DisposedBy(DisposeBag);

            TextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);
        }
Ejemplo n.º 9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new SelectProjectTableViewSource();

            source.RegisterViewCells(ProjectsTableView);

            source.UseGrouping = ViewModel.UseGrouping;

            ProjectsTableView.TableFooterView = new UIView();
            ProjectsTableView.Source          = source;

            var suggestionsReplay = ViewModel.Suggestions.Replay();

            suggestionsReplay
            .Subscribe(ProjectsTableView.Rx().ReloadSections(source))
            .DisposedBy(DisposeBag);

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                suggestionsReplay
                .Select((sections) =>
                {
                    var numberOfSections    = sections.ToList().Count();
                    var numberOfSuggestions = sections.Select(s => s.Items.Count()).Sum();
                    return(numberOfSections, numberOfSuggestions);
                })
                .Select((result) =>
                {
                    var(numberOfSections, numberOfSuggestions) = result;
                    var headersHeight = ViewModel.UseGrouping
                            ? numberOfSections * SelectProjectTableViewSource.HeaderHeight
                            : 0;
                    var suggestionsHeight = numberOfSuggestions * SelectProjectTableViewSource.RowHeight;
                    var contentHeight     = numberOfSuggestions == 1
                            ? placeHolderHeight
                            : headersHeight + suggestionsHeight;
                    return(new CGSize(0, contentHeight + headerHeight));
                })
                .Subscribe(this.Rx().PreferredContentSize())
                .DisposedBy(DisposeBag);
            }

            suggestionsReplay.Connect();

            ViewModel.IsEmpty
            .Subscribe(EmptyStateLabel.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.IsEmpty
            .Subscribe(EmptyStateImage.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.PlaceholderText
            .Subscribe(TextField.Rx().PlaceholderText())
            .DisposedBy(DisposeBag);

            TextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            CloseButton.Rx().Tap()
            .Subscribe(ViewModel.CloseWithDefaultResult)
            .DisposedBy(DisposeBag);

            source.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectProject.Inputs)
            .DisposedBy(DisposeBag);

            source.ToggleTaskSuggestions
            .Subscribe(ViewModel.ToggleTaskSuggestions.Inputs)
            .DisposedBy(DisposeBag);
        }