Example #1
0
        /// <summary>
        /// Add custom client methods
        /// </summary>
        public void AlertNotify(string title, string message, long timeout, string icon)
        {
            try
            {
                ToolTipIcon tipIcon = ToolTipIcon.Info;

                if (!icon.Equals("Information", StringComparison.OrdinalIgnoreCase)) // No information icon
                {
                    ToolTipIcon.TryParse(icon, true, out tipIcon);
                }

                var notify = new NotifyIcon
                {
                    Text            = message,
                    BalloonTipTitle = title,
                    BalloonTipText  = message,
                    Icon            = Core.Properties.Resources.Led,
                    Visible         = true,
                    BalloonTipIcon  = tipIcon
                };

                notify.BalloonTipClosed += (sender, args) =>
                {
                    notify.Visible = false;
                    notify.Dispose();
                };

                notify.ShowBalloonTip(unchecked ((int)timeout));
            }
            catch (Exception exp)
            {
                Debug.WriteLine(exp.Message);
            }
        }