public ToastPromtsHostControl()
 {
     _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
 }
Ejemplo n.º 2
0
        public ToastPromtsHostControl()
        {
            _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);

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