Exemplo n.º 1
0
 public BaseMatToastItem()
 {
     State = MatToastState.Init;
     ContainerClassMapper
     .Add("mat-toast")
     .Get(() => Toast.Options.Class)
     .Get(() => MatToastConfiguration.ToastTypeClass(Toast.Options.Type));
     Timer = new MatToastTransitionTimer(TimerElapsed);
 }
Exemplo n.º 2
0
        public MatToastTransitionState(MatToastTransitionTimer timer, int maximumOpacity)
        {
            Duration              = timer.Duration;
            MaxOpacity            = Convert.ToDouble(maximumOpacity) / 100;
            RemainingMilliseconds = Convert.ToInt32(timer.RemainingMilliseconds);

            if (Duration == 0 || RemainingMilliseconds <= 0)
            {
                Ratio = 0;
            }
            else if (timer.RemainingMilliseconds > Duration)
            {
                Ratio = 1;
            }
            else
            {
                Ratio = timer.RemainingMilliseconds / Duration;
            }
        }