public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _cardStack = VisualTreeHelper.GetChild(this, 0) as AnimationStackPanel;
            var noticeCard = new NoticeXCard();

            _cardStack.Children.Add(noticeCard);
            _cardStack.Children.Remove(noticeCard);
            Hide();
        }
Exemple #2
0
        private void NoticeWindow_Initialized(object sender, EventArgs e)
        {
            var area = SystemParameters.WorkArea;

            Left   = area.Right - Width;
            Top    = 0;
            Height = area.Bottom;

            //必须加这一段,第一次样式不会生效
            {
                var noticeCard = new NoticeXCard();
                AstpCard.Children.Add(noticeCard);
                AstpCard.Children.Remove(noticeCard);
                Hide();
            }
        }
Exemple #3
0
 public void AddCard(string message, string caption, MessageBoxIcon?icon, string imageSource, int?intervalMs, bool canClose)
 {
     Dispatcher.Invoke(new Action(() =>
     {
         Show();
         NoticeXCard noticeCard = null;
         if (imageSource != null)
         {
             noticeCard = new NoticeXCard(message, caption, imageSource, intervalMs, canClose);
         }
         else
         {
             noticeCard = new NoticeXCard(message, caption, icon, intervalMs, canClose);
         }
         noticeCard.Opacity = 0;
         noticeCard.Loaded += NoticeCard_Loaded;
         AstpCard.Children.Add(noticeCard);
         AstpCard.Width = noticeCard.Width;
         Left           = SystemParameters.WorkArea.Width - noticeCard.Width;
     }));
 }