コード例 #1
0
        public ToasterWindow(FrameworkElement owner, string title, string message,
                             ToasterPosition position, ToasterAnimation animation, double margin)
        {
            InitializeComponent();
            ToasterTitle = title;
            Message      = message;
            Position     = position;
            Animation    = animation;
            Margins      = margin;

            var story = ToastSupport.GetAnimation(Animation, Notification);

            story.Completed += (sender, args) => { Close(); };
            story.Begin(Notification);

            Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(() =>
            {
                var topLeftDict = ToastSupport.GetTopandLeft(Position, this, Margins);
                Top             = topLeftDict["Top"];
                Left            = topLeftDict["Left"];
            }));

            if (owner != null)
            {
                owner.Unloaded += Owner_Unloaded;
            }
        }
コード例 #2
0
        private SuccessToaster(FrameworkElement owner, string title, string message, ToasterPosition position, ToasterAnimation animation, double margin)
        {
            InitializeComponent();

            ToasterTitle = title;
            Message      = message ?? string.Empty;

            var story = ToastSupport.GetAnimation(animation, ref SuccessToasterInstance);

            story.Completed += (sender, args) => { this.Close(); };
            story.Begin(SuccessToasterInstance);

            Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(() =>
            {
                var topLeftDict = ToastSupport.GetTopandLeft(position, this, margin);
                Top             = topLeftDict["Top"];
                Left            = topLeftDict["Left"];
            }));
            owner.Unloaded += Owner_Unloaded;
        }