public static void GetSmoll(NotificationControlPBar 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); } }
public static void UpdateNotificationWBarNImg(NotificationControlPBar nbar, string pBarText, double pBarValue) { nbar.pBarText.Text = pBarText; nbar.pbar.Value = pBarValue; if (nbar.pbar.Value >= nbar.pbar.Maximum) { GetSmoll(nbar, 0); } }
private static void GetThicc(NotificationControlPBar 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); }
public static NotificationControlPBar CreateNotificationWPBarNImg(string header, string caption, string pBarText, double pBarValue, int pBarMax) { NotificationControlPBar notificationControl = new NotificationControlPBar(); notificationControl.Width = 350; notificationControl.Height = 80; notificationControl.HorizontalAlignment = HorizontalAlignment.Right; notificationControl.VerticalAlignment = VerticalAlignment.Bottom; notificationControl.Margin = new Thickness(0, 0, 0, 40); notificationControl.header.Text = header; notificationControl.pBarText.Text = pBarText; notificationControl.caption.Text = caption; notificationControl.pbar.Maximum = pBarMax; notificationControl.pbar.Value = pBarValue; notificationControl.Name = "notificationControl"; notificationControl.RegisterName(notificationControl.Name, notificationControl); NotificationControlForList(header + " Finished", "", caption); GetThicc(notificationControl); return(notificationControl); }