Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="title"></param>
        /// <param name="body"></param>
        /// <param name="duration"></param>
        /// <param name="animation"></param>
        /// <param name="direction"></param>
        public Notification(string type, string title, string body, int duration, dirClasses.FormAnimator.AnimationMethod animation, dirClasses.FormAnimator.AnimationDirection direction)
        {
            InitializeComponent();

            if (type.ToLower() == "warning")
            {
                labelTitle.BackColor = Color.FromArgb(255, 176, 0);
                labelBody.BackColor  = Color.White;
            }
            else if (type.ToLower() == "error")
            {
                labelTitle.BackColor = Color.FromArgb(255, 130, 66);
                labelBody.BackColor  = Color.White;
            }
            else
            {
                labelTitle.BackColor = Color.FromArgb(47, 97, 72);
                labelBody.BackColor  = Color.White;
            }

            if (duration < 0)
            {
                duration = int.MaxValue;
            }
            else
            {
                duration = duration * 1000;
            }

            lifeTimer.Interval = duration;
            labelTitle.Text    = title;
            labelBody.Text     = body;

            _animator = new dirClasses.FormAnimator(this, animation, direction, 500);

            Region = Region.FromHrgn(dirClasses.NativeMethods.CreateRoundRectRgn(0, 0, Width, Height, 0, 0));
        }