Example #1
0
        public IEnumerator AttemptDetailView(Action successHandler)
        {
            if (ITTDataCache.Instance.HasSessionCredentials)
            {
                if (null != successHandler)
                {
                    successHandler();
                }
            }
            else if (!ITTDataCache.Instance.HasSessionCredentials)
            {
                if (null != CurrentScreen)
                {
                    IScreenViewBase screen = CurrentScreen as IScreenViewBase;
                    if (null != screen)
                    {
                        StartCoroutine(screen.OnHide());
                    }
                }

                OnboardingViewController.Spawn(successHandler);
                StartCoroutine(OnboardingView.OnDisplay());
            }

            yield break;
        }
Example #2
0
        public IEnumerator AttemptAuthenticatedStateChange(Enum desiredState)
        {
            if (ITTDataCache.Instance.HasSessionCredentials)
            {
                currentState = desiredState;
            }
            else if (!ITTDataCache.Instance.HasSessionCredentials)
            {
                bufferedState = desiredState;

                if (null != CurrentScreen)
                {
                    IScreenViewBase screen = CurrentScreen as IScreenViewBase;
                    if (null != screen)
                    {
                        StartCoroutine(screen.OnHide());
                    }
                }

                OnboardingViewController.Spawn(EnterBufferedState);
                StartCoroutine(OnboardingView.OnDisplay());
            }

            yield break;
        }
Example #3
0
        void ReleaseDesignerOutlets()
        {
            if (CalendarCollectionView != null)
            {
                CalendarCollectionView.Dispose();
                CalendarCollectionView = null;
            }

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

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

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

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }
        }
Example #4
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;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

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

            this.Bind(ViewModel.ShouldShowOnboarding, OnboardingView.Rx().IsVisibleWithFade());
            this.Bind(GetStartedButton.Rx().Tap(), ViewModel.GetStartedAction);

            var timeService = Mvx.Resolve <ITimeService>();

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

            layout = new CalendarCollectionViewLayout(timeService, dataSource);

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

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

            this.Bind(dataSource.ItemTapped, ViewModel.OnItemTapped);
            this.Bind(settingsButton.Rx().Tap(), ViewModel.SelectCalendars);
            this.Bind(editItemHelper.EditCalendarItem, ViewModel.OnUpdateTimeEntry);
            this.Bind(ViewModel.SettingsAreVisible, settingsButton.Rx().IsVisible());
            this.Bind(createFromSpanHelper.CreateFromSpan, ViewModel.OnDurationSelected);

            CalendarCollectionView.LayoutIfNeeded();
            var currentTimeY     = layout.FrameForCurrentTime().Y;
            var scrollPointY     = currentTimeY - View.Frame.Height / 2;
            var currentTimePoint = new CGPoint(0, scrollPointY.Clamp(0, CalendarCollectionView.ContentSize.Height));

            CalendarCollectionView.SetContentOffset(currentTimePoint, false);
        }
        public async void NextButton_OnClicked(object sender, EventArgs e)
        {
            if (_isButtonBusy || !NextButton.IsEnabled)
            {
                return;
            }

            _isButtonBusy = true;

            if (BindingContext is OnboardingViewModel vm)
            {
                if (!vm.NextCommand.CanExecute(null))
                {
                    return;
                }

                // fade out
#pragma warning disable 4014
                NextButton.TranslateTo(0, 100, easing: Easing.SpringIn);
#pragma warning restore 4014
                await OnboardingView.FadeTo(0);

                // execute
                vm.NextCommand.Execute(null);
                // fade in
                await OnboardingView.FadeTo(1);

                await NextButton.TranslateTo(0, 0, easing : Easing.SpringOut);
            }
            else
            {
#pragma warning disable 4014
                NextButton.TranslateTo(0, 100);
#pragma warning restore 4014
                await OnboardingView.FadeTo(0);

                await OnboardingView.FadeTo(1);

                await NextButton.TranslateTo(0, 0, easing : Easing.SpringOut);
            }
            _isButtonBusy = false;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ExtendedNavbarView.BackgroundColor = NavigationController.NavigationBar.BackgroundColor;
            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();
        }