/// <summary> /// Show the notification window if it is not already visible. /// If the window is currently disappearing, it is shown again. /// </summary> public void Popup() { if (!disposed) { if (!frmPopup.Visible) { frmPopup.Size = Size; if (Scroll) { posStart = Screen.PrimaryScreen.WorkingArea.Bottom; posStop = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height; } else { posStart = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height; posStop = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height; } opacityStart = 0; opacityStop = 1; frmPopup.Opacity = opacityStart; frmPopup.Location = new Point(Screen.PrimaryScreen.WorkingArea.Right - frmPopup.Size.Width - 1, posStart); frmPopup.Visible = true; isAppearing = true; tmrWait.Interval = Delay; tmrAnimation.Interval = AnimationInterval; realAnimationDuration = AnimationDuration; tmrAnimation.Start(); sw = System.Diagnostics.Stopwatch.StartNew(); System.Diagnostics.Debug.WriteLine("Animation started."); } else { if (!isAppearing) { frmPopup.Size = Size; if (Scroll) { posStart = frmPopup.Top; posStop = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height; } else { posStart = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height; posStop = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height; } opacityStart = frmPopup.Opacity; opacityStop = 1; isAppearing = true; realAnimationDuration = Math.Max((int)sw.ElapsedMilliseconds, 1); sw.Restart(); System.Diagnostics.Debug.WriteLine("Animation direction changed."); } frmPopup.Invalidate(); } } }
/// <summary> /// Show the notification window if it is not already visible. /// If the window is currently disappearing, it is shown again. /// </summary> public void Popup() { if (!disposed) { if (!frmPopup.Visible) { frmPopup.Size = Size; if (Scroll) { posStart = Screen.PrimaryScreen.WorkingArea.Bottom; posStop = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height - 50; } else { posStart = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height - 50; posStop = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height - 50; } opacityStart = 0; opacityStop = 1; frmPopup.Opacity = opacityStart; frmPopup.Location = new Point(Screen.PrimaryScreen.WorkingArea.Right - frmPopup.Size.Width - 50, posStart); frmPopup.Visible = true; isAppearing = true; tmrWait.Interval = Delay; tmrAnimation.Interval = AnimationInterval; realAnimationDuration = AnimationDuration; tmrAnimation.Start(); sw = System.Diagnostics.Stopwatch.StartNew(); System.Diagnostics.Debug.WriteLine("Animation started."); } else { frmPopup.Invalidate(); } } }