Exemplo n.º 1
0
        void ReleaseDesignerOutlets()
        {
            if (CalendarCollectionView != null)
            {
                CalendarCollectionView.Dispose();
                CalendarCollectionView = null;
            }

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

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

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

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

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

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

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

            ExtendedNavbarView.BackgroundColor = NavigationController.NavigationBar.BackgroundColor;
            var separator = ExtendedNavbarView.InsertSeparator();

            separator.BackgroundColor  = ColorAssets.OpaqueSeparator;
            TimeTrackedTodayLabel.Font = TimeTrackedTodayLabel.Font.GetMonospacedDigitFont();

            TitleLabel.Text       = Resources.Welcome;
            DescriptionLabel.Text = Resources.CalendarFeatureDescription;
            GetStartedButton.SetTitle(Resources.GetStarted, UIControlState.Normal);

            settingsButton.SetImage(UIImage.FromBundle("icSettings"), UIControlState.Normal);

            ViewModel
            .ShouldShowOnboarding
            .FirstAsync()
            .Subscribe(
                shouldShowOnboarding => OnboardingView.Alpha = shouldShowOnboarding ? 1 : 0)
            .DisposedBy(DisposeBag);

            ViewModel.ShouldShowOnboarding
            .Subscribe(OnboardingView.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            GetStartedButton.Rx()
            .BindAction(ViewModel.GetStarted)
            .DisposedBy(DisposeBag);

            ViewModel.TimeTrackedToday
            .Subscribe(TimeTrackedTodayLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.CurrentDate
            .Subscribe(CurrentDateLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            dataSource = new CalendarCollectionViewSource(
                timeService,
                CalendarCollectionView,
                ViewModel.TimeOfDayFormat,
                ViewModel.CalendarItems);

            layout = new CalendarCollectionViewLayout(timeService, dataSource);

            editItemHelper       = new CalendarCollectionViewEditItemHelper(CalendarCollectionView, timeService, dataSource, layout);
            createFromSpanHelper = new CalendarCollectionViewCreateFromSpanHelper(CalendarCollectionView, dataSource, layout);
            zoomHelper           = new CalendarCollectionViewZoomHelper(CalendarCollectionView, layout);

            CalendarCollectionView.SetCollectionViewLayout(layout, false);
            CalendarCollectionView.Delegate     = dataSource;
            CalendarCollectionView.DataSource   = dataSource;
            CalendarCollectionView.ContentInset = new UIEdgeInsets(20, 0, 20, 0);

            dataSource.ItemTapped
            .Subscribe(ViewModel.OnItemTapped.Inputs)
            .DisposedBy(DisposeBag);

            settingsButton.Rx()
            .BindAction(ViewModel.SelectCalendars)
            .DisposedBy(DisposeBag);

            editItemHelper.EditCalendarItem
            .Subscribe(ViewModel.OnUpdateTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            editItemHelper.LongPressCalendarEvent
            .Subscribe(ViewModel.OnCalendarEventLongPressed.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.SettingsAreVisible
            .Subscribe(settingsButton.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            createFromSpanHelper.CreateFromSpan
            .Subscribe(ViewModel.OnDurationSelected.Inputs)
            .DisposedBy(DisposeBag);

            CalendarCollectionView.LayoutIfNeeded();
            View.BackgroundColor = ColorAssets.TableBackground;
        }