public static Control NotificationNoImg(string header, string underline, string caption) { NotificationControl notificationControl = new NotificationControl(); //DoubleAnimation da = new DoubleAnimation(); //da.From = 0; //da.To = 360; //da.Duration = new Duration(TimeSpan.FromSeconds(3)); //da.RepeatBehavior = RepeatBehavior.Forever; //RotateTransform rt = new RotateTransform(); //notificationControl.RenderTransform = rt; //rt.BeginAnimation(RotateTransform.AngleProperty, da); notificationControl.Width = 350; notificationControl.Height = 80; notificationControl.HorizontalAlignment = HorizontalAlignment.Right; notificationControl.VerticalAlignment = VerticalAlignment.Bottom; notificationControl.Margin = new Thickness(0, 0, 0, 10); notificationControl.header.Text = header; notificationControl.underline.Text = underline; notificationControl.caption.Text = caption; notificationControl.Name = "notificationControl"; notificationControl.LayoutTransform = new RotateTransform(180); notificationControl.RegisterName(notificationControl.Name, notificationControl); GetThicc(notificationControl); GetSmoll(notificationControl); NotificationControlForList(header, underline, caption); notificationControl.boarder.BorderBrush = DoujinUtility.MainWindow.animatedBrush; return(notificationControl); }
private static void GetSmoll(NotificationControl notificationControl, int timeSpanSec = 5) { DoubleAnimation getSmoll = new DoubleAnimation(); TimeSpan timeSpan = TimeSpan.FromSeconds(timeSpanSec); getSmoll.From = notificationControl.Width; getSmoll.To = 0; getSmoll.Duration = new Duration(TimeSpan.FromMilliseconds(300)); Storyboard.SetTargetName(getSmoll, notificationControl.Name); Storyboard.SetTargetProperty(getSmoll, new PropertyPath(Window.WidthProperty)); Storyboard sb1 = new Storyboard(); sb1.Children.Add(getSmoll); DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = timeSpan; dispatcherTimer.Start(); void dispatcherTimer_Tick(object sender, EventArgs e) { dispatcherTimer.IsEnabled = false; sb1.Begin(notificationControl); } }
private static void GetThicc(NotificationControl notificationControl) { DoubleAnimation getThicc = new DoubleAnimation(); getThicc.From = 0; getThicc.To = 350; getThicc.Duration = new Duration(TimeSpan.FromMilliseconds(300)); Storyboard.SetTargetName(getThicc, notificationControl.Name); Storyboard.SetTargetProperty(getThicc, new PropertyPath(Window.WidthProperty)); Storyboard sb1 = new Storyboard(); sb1.Children.Add(getThicc); sb1.Begin(notificationControl); }