/// <summary> /// Reposition every (active) RemindMeMaterialMessageForms so that if the first(on the bottom) form disposes, the other forms should go down. /// </summary> public static void RepositionActivePopups() { int activeFormCount = PopupForms.Count; //One active popup form? set it to default position if (activeFormCount == 1) { //Set the location to the bottom right corner of the user's screen and a little bit above the taskbar since there's only one left RemindMeMaterialMessageForm form = PopupForms[0]; try { form.Invoke((MethodInvoker)(() => { form.Location = new Point(Screen.GetWorkingArea(form).Width - form.Width - 5, Screen.GetWorkingArea(form).Height - form.Height - 5); })); } catch { form.IsClosed = true; form.Dispose(); } } else { List <RemindMeMaterialMessageForm> forms = popupForms.Where(f => !f.IsClosed).ToList(); //Reset all forms to the bottom right corner foreach (RemindMeMaterialMessageForm frm in forms) { if (frm.IsDisposed) { frm.IsClosed = true; } else { frm.Location = new Point(Screen.GetWorkingArea(frm).Width - frm.Width - 5, Screen.GetWorkingArea(frm).Height - frm.Height - 5); } } RemindMeMaterialMessageForm form; //Now work our way up for (int i = 0; i < forms.Count; i++) { form = forms[i]; if (i > 0) { form.Location = new Point(form.Location.X, (forms[i - 1].Location.Y - form.Height) - 5); } } } //Lets just clear the disposed forms List <RemindMeMaterialMessageForm> toRemoveForms = popupForms.Where(form => form.IsClosed).ToList(); foreach (RemindMeMaterialMessageForm form in toRemoveForms) { popupForms.Remove(form); } }
/// <summary> /// Creates an animated message popup at the bottom-right corner of the screen /// </summary> /// <param name="message">The message this form should display</param> /// <param name="popDelay">The time this form will be visible in seconds</param> /// <param name="rem">The reminder that is in this message popup. Gives the user the option to disable it</param> public static void MakeMessagePopup(string message, int popDelay, Reminder rem) { RemindMeMaterialMessageForm popupForm = new RemindMeMaterialMessageForm(message, popDelay, rem); MaterialSkin.MaterialSkinManager.Instance.AddFormToManage(popupForm); popupForm.Show(); popupForms.Add(popupForm); //Add the popupform }
/// <summary> /// Creates an animated message popup at the bottom-right corner of the screen /// </summary> /// <param name="message">The message this form should display</param> /// <param name="popDelay">The time this form will be visible in seconds</param> public static void MakeMessagePopup(string message, int popDelay, string title = "") { RemindMeMaterialMessageForm popupForm = new RemindMeMaterialMessageForm(message, popDelay); MaterialSkin.MaterialSkinManager.Instance.AddFormToManage(popupForm); if (title != "") { popupForm.Title = title; } popupForm.Invoke((MethodInvoker)(() => { popupForm.Show(); })); popupForms.Add(popupForm); //Add the popupform }