public void popup(string strTitle, string strContent, int nTimeToShow, int nTimeToStay, int nTimeToHide, int notify, Image imageshow) { System.Diagnostics.Debug.WriteLine("New message to show"); isAppearing = true; if (do_once == true) { timer1.Enabled = false; frmPopup.Opacity = 1; frmPopup.Show(); do_once = false; animation_working = false; } // tmrAnimation.Stop(); if (timelist.Count > 4) { timelist_wait.Add(getcurrenttime()); message_cont_wait.Add(strTitle); message_type_wait.Add(strContent); message_image_wait.Add(imageshow); } else { timelist.Add(pop_show_time + getcurrenttime()); message_type.Add(strTitle); message_cont.Add(strContent); message_image.Add(imageshow); } frmPopup.cont_post = timelist.Count; frmPopup.timelist_data = timelist; frmPopup.message_cont_show = message_cont; frmPopup.message_type_show = message_type; frmPopup.message_image_show = message_image; if (timer1.Enabled != true) { timer1.Enabled = true; timer1.Interval = pop_show_time * (1000); //milisecond } if (timelist_wait.Count == 0) { refreshform(true); } }
/// <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.Show(); isAppearing = true; tmrWait.Interval = Delay; tmrAnimation.Interval = AnimationInterval; tmrAnimation.Start(); sw = System.Diagnostics.Stopwatch.StartNew(); System.Diagnostics.Debug.WriteLine("Animation started."); } else { if (!isAppearing) { frmPopup.Top = maxPosition; frmPopup.Opacity = maxOpacity; tmrAnimation.Stop(); System.Diagnostics.Debug.WriteLine("Animation stopped."); tmrWait.Stop(); tmrWait.Start(); System.Diagnostics.Debug.WriteLine("Wait timer started."); } frmPopup.Invalidate(); } } }