Пример #1
0
        private void TransitionTo(SnackbarState state)
        {
            StopTimer();
            State.SnackbarState = state;
            var options = State.Options;

            if (state.IsShowing())
            {
                if (options.ShowTransitionDuration <= 0)
                {
                    TransitionTo(SnackbarState.Visible);
                }
                else
                {
                    StartTimer(options.ShowTransitionDuration);
                }
            }
            else if (state.IsVisible() && !options.RequireInteraction)
            {
                if (options.VisibleStateDuration <= 0)
                {
                    TransitionTo(SnackbarState.Hiding);
                }
                else
                {
                    StartTimer(options.VisibleStateDuration);
                }
            }
            else if (state.IsHiding())
            {
                if (options.HideTransitionDuration <= 0)
                {
                    OnClose?.Invoke(this);
                }
                else
                {
                    StartTimer(options.HideTransitionDuration);
                }
            }

            OnUpdate?.Invoke();
        }
Пример #2
0
 public static bool IsVisible(this SnackbarState state) => state == SnackbarState.Visible;
Пример #3
0
 public static bool IsHiding(this SnackbarState state) => state == SnackbarState.Hiding;
Пример #4
0
 public static bool IsShowing(this SnackbarState state) => state == SnackbarState.Showing;