Inheritance: Windows.UI.Xaml.Controls.UserControl
Exemple #1
0
        public async static void Show(string message, string title, Brush foregroundTextBrush, Brush countdownBackgroundBrush, double timeToLive, bool autoHide = false, double width = 300, double height = 180,  string metroIcon = "", string imageIcon = "", double scaleIcon = 1)
        {

            if (NotificationService._rootControl != null && message != null)
            {
                DispatchedHandler invokedHandler = new DispatchedHandler(() =>
                {
                    if (NotificationService._rootControl == null) //|| MsgBoxService._rootControl.Visibility == Visibility.Visible)
                    {
                        return;
                    }
                    NotificationService._rootControl.Visibility = Visibility.Visible;
                    NotificationView view = new NotificationView(message, "", autoHide, timeToLive, metroIcon, imageIcon: imageIcon, scaleIcon: scaleIcon);
                    view.Width = width;
                    view.Height = height;
                    view.Margin = new Thickness(3);
                    //view.HorizontalAlignment = horizontalAlignment;
                    //view.VerticalAlignment = VerticalAlignment.Top;
                    
                    view.MessageTextForegroundColor = foregroundTextBrush;
                    view.CountdownBackgroundColor = countdownBackgroundBrush;
                    view.Show();
                    view.OnClosing += new EventHandler(NotificationService.view_OnClosing);

                    NotificationService._MsgboxContainer.Children.Insert(0, view);
                    
                });
                await NotificationService._rootControl.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, invokedHandler);
            }
        }
        private static void CountdownBackgroundColorPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NotificationView ctl = (NotificationView)obj;

            ctl.recTimeLeft.Fill   = (Brush)args.NewValue;
            ctl.recTimeLeft.Stroke = (Brush)args.NewValue;
        }
        private static void MessageTextForegroundColorPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NotificationView ctl = (NotificationView)obj;

            ctl.lblMessage.Foreground = (Brush)args.NewValue;
        }
        private static void BackgroundFillPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NotificationView ctl = (NotificationView)obj;

            ctl.layoutRoot.Background = (Brush)args.NewValue;
        }