예제 #1
0
        /// <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)
        {
            RemindMeMessageForm popupForm = new RemindMeMessageForm(message, popDelay, rem);

            popupForm.Show();

            popupForms.Add(popupForm); //Add the popupform
        }
예제 #2
0
        /// <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 = "")
        {
            RemindMeMessageForm popupForm = new RemindMeMessageForm(message, popDelay);

            if (title != "")
            {
                popupForm.Title = title;
            }

            popupForm.Invoke((MethodInvoker)(() =>
            {
                popupForm.Show();
            }));
            popupForms.Add(popupForm); //Add the popupform
        }
예제 #3
0
        /// <summary>
        /// Reposition every (active) RemindMeMessageForms 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
                RemindMeMessageForm form = PopupForms[0];
                form.Invoke((MethodInvoker)(() =>
                {
                    form.Location = new Point(Screen.GetWorkingArea(form).Width - form.Width - 5, Screen.GetWorkingArea(form).Height - form.Height - 5);
                }));
            }
            else
            {
                List <RemindMeMessageForm> forms = popupForms.Where(f => !f.IsDisposed).ToList();

                //Reset all forms to the bottom right corner
                foreach (RemindMeMessageForm frm in forms)
                {
                    frm.Location = new Point(Screen.GetWorkingArea(frm).Width - frm.Width - 5, Screen.GetWorkingArea(frm).Height - frm.Height - 5);
                }

                RemindMeMessageForm 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 <RemindMeMessageForm> toRemoveForms = popupForms.Where(form => form.IsDisposed).ToList();

            foreach (RemindMeMessageForm form in toRemoveForms)
            {
                popupForms.Remove(form);
            }
        }
예제 #4
0
        /// <summary>
        /// Reposition every (active) RemindMeMessageForms 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;

            //No active popup forms? 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
                RemindMeMessageForm form = PopupForms[0];
                form.Invoke((MethodInvoker)(() =>
                {
                    form.Location = new Point(Screen.GetWorkingArea(form).Width - form.Width - 5, Screen.GetWorkingArea(form).Height - form.Height - 5);
                }));
            }
            else
            {
                foreach (RemindMeMessageForm form in PopupForms)
                {
                    form.Invoke((MethodInvoker)(() =>
                    {
                        //Do NOT move the form down if it is the bottom one
                        if (form.Location.Y != Screen.GetWorkingArea(form).Height - form.Height - 5)
                        {
                            //Check if there is one below you
                            if (!IsFormAt(new Point(form.Location.X, (form.Location.Y + form.Height) + 5)))
                            {
                                //Put all messageforms one down.
                                form.Location = new Point(form.Location.X, (form.Location.Y + form.Height) + 5);
                            }
                        }
                    }));
                }
            }


            //Lets just clear the disposed forms
            List <RemindMeMessageForm> toRemoveForms = popupForms.Where(form => form.IsDisposed).ToList();

            foreach (RemindMeMessageForm form in toRemoveForms)
            {
                popupForms.Remove(form);
            }

            toRemoveForms.Clear();
        }