Example #1
0
        public void Notify(NotifyControl control, int timeout)
        {
            if (_mainForm.InvokeRequired)
            {
                _mainForm.BeginInvoke(new Action <NotifyControl, int>(Notify), control, timeout);
                return;
            }

            var notifyForm = new NotifyForm(control)
            {
                NotifyControl = control,
                Timeout       = timeout
            };

            notifyForm.SetPosition(GetNextPosition(notifyForm.Width, notifyForm.Height));
            lock (_notifyForms)
            {
                _notifyForms.Add(notifyForm);
            }

            notifyForm.FormClosed += NotifyFormClosed;

            control.NotifyForm = notifyForm;
            control.NotifyOnCreate();

            notifyForm.ShowGracefully();
        }