Beispiel #1
0
        public ToastPromptsHostControl()
        {
            activeItemsControl = new ItemsControl {
                Background = new SolidColorBrush(Colors.Transparent)
            };
            Children.Add(activeItemsControl);

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += Timer_OnTick;
            timer.Start();
            lastUsedInstance = this; //instance is defined in xaml
        }
        public Task <bool> Notify(ToastNotificationType type, string title, string description, TimeSpan duration, object context, bool clickable = true)
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();

            Brush brush;
            var   element = customRenderer.Render(type, title, description, context, out brush);

            ToastPromptsHostControl.EnqueueItem(element, b =>
            {
                if (clickable)
                {
                    taskCompletionSource.TrySetResult(b);
                }
            }, brush,
                                                tappable: customRenderer.IsTappable,
                                                timeout: duration,
                                                showCloseButton: customRenderer.HasCloseButton);
            return(taskCompletionSource.Task);
        }
 public void HideAll()
 {
     ToastPromptsHostControl.Clear();
 }