示例#1
0
        private void ShowHost(Rect?container)
        {
            //If the current host window is null, create it.
            if (_HOST == null)
            {
                _HOST = new ToastNotificationHost()
                {
                    DisplayOrigin = container
                };

                _HOST.Show();
                _HOST.Closed += _HOST_Closed;
            }
            //Otherwise, set it's display location and origin.
            else
            {
                _HOST.DisplayOrigin = container;
            }

            _HOST.Reposition();

            //Display the window
            if (!_HOST.IsVisible)
            {
                _HOST.Visibility = Visibility.Visible;
            }
        }
        private static void DisplayOriginChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToastNotificationHost host = (ToastNotificationHost)d;

            host.Reposition();
        }
示例#3
0
 private void _HOST_Closed(object sender, EventArgs e)
 {
     //Reset the host.
     _HOST.Closed -= _HOST_Closed;
     _HOST         = null;
 }