Beispiel #1
0
        public void MakeToast(string message, ToastPriority priority, ToastLength length) => Device.BeginInvokeOnMainThread(() =>
        {
            if (Priority == ToastPriority.Low)
            {
                toast?.Cancel();
            }

            if (Priority == ToastPriority.High && (priority == ToastPriority.High || priority == ToastPriority.Critical))
            {
                toast?.Cancel();
            }

            if (toast != null && !toast.View.IsShown)
            {
                Priority = priority;
            }

            toast = Toast.MakeText(Forms.Context, message, length);
            toast.Show();
        });
Beispiel #2
0
 private static void Toaster(string message, ToastPriority priority, ToastLength length)
 => Device.BeginInvokeOnMainThread(()
                                   => DependencyService.Get <INotifier>().MakeToast(message, priority, length));