//----- End of the codes.
        #region Method
        //-----
        #region ShowAlert
        /// <summary>
        /// A function that displays a notification with three message inputs, caption, and photos.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="caption"></param>
        /// <param name="picture"></param>
        public void ShowAlert(string message, Caption caption, string picture)
        {
            this.Opacity       = 0.0;
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

            string name;

            for (int i = 1; i < 10; i++)
            {
                name = "alert" + i.ToString();

                PopupNotificationForm popupNotification = (PopupNotificationForm)System.Windows.Forms.Application.OpenForms[name];

                if (popupNotification == null)
                {
                    this.Name     = name;
                    this.x        = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15;
                    this.y        = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - this.Height * i - 5 * i;
                    this.Location = new System.Drawing.Point(this.x, this.y);
                    break;
                }
            }

            this.x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5;

            switch (caption)
            {
            case Caption.موفقیت:
                alertIconPicturBox.Image = Resturant.Properties.Resources.succes_512;
                BackColor         = System.Drawing.Color.SeaGreen;
                captionLabel.Text = Caption.موفقیت.ToString();
                break;

            case Caption.اخطار:
                alertIconPicturBox.Image = Resturant.Properties.Resources.warning_512;
                BackColor         = System.Drawing.Color.DarkOrange;
                captionLabel.Text = Caption.اخطار.ToString();
                break;

            case Caption.خطا:
                alertIconPicturBox.Image = Resturant.Properties.Resources.error_512;
                BackColor         = System.Drawing.Color.DarkRed;
                captionLabel.Text = Caption.خطا.ToString();
                break;

            case Caption.اطلاع:
                alertIconPicturBox.Image = Resturant.Properties.Resources.info_512;
                BackColor         = System.Drawing.Color.RoyalBlue;
                captionLabel.Text = Caption.اطلاع.ToString();
                break;
            }

            this.objectpicturBox.Image  = System.Drawing.Image.FromFile(picture);
            this.alertMessageLabel.Text = message;

            this.Show();
            this.action          = Action.start;
            this.timer1.Interval = 1;
            this.timer1.Start();
        }
Esempio n. 2
0
 private void PushForce(NotificationContent notification)
 {
     var window = new PopupNotificationForm(notification);
     var h = window.Height;
     var x = _origin.X;
     var y = _origin.Y - h;
     window.Left = x;
     window.Top = y;
     _windows.Add(window);
     MakeRoomInStack(window);
     window.SizeChanged += OnWindowSizeChanged;
     AnimateFadeIn(window);
     window.Closed	+= OnWindowClosed;
     window.Show();
 }
Esempio n. 3
0
 private void MakeRoomInStack(PopupNotificationForm window)
 {
     int index = _windows.IndexOf(window);
     if(index == -1) return;
     var desiredTop = _origin.Y - _windows[_windows.Count - 1].Height;
     for(int i = _windows.Count - 2; i >= index + 1; --i)
     {
         desiredTop -= _windows[i].Height - WindowSpacing;
     }
     if(window.Top > desiredTop)
     {
         AnimateVerticalSlide(window, desiredTop);
     }
     var w2 = window;
     for(int i = index - 1; i >= 0; --i)
     {
         var w1 = _windows[i];
         desiredTop = desiredTop - w1.Height - WindowSpacing;
         if(w1.Top > desiredTop)
         {
             AnimateVerticalSlide(w1, desiredTop);
         }
         else
         {
             break;
         }
         w2 = w1;
     }
 }
Esempio n. 4
0
 private static void AnimateVerticalSlide(PopupNotificationForm window, int targetTop)
 {
     window.Top = targetTop;
 }
Esempio n. 5
0
 private static void AnimateFadeIn(PopupNotificationForm window)
 {
 }