Example #1
0
        /// <summary>
        /// Completes the layout after new controls have been added.
        /// </summary>
        private void CompleteLayout()
        {
            // Fix the panel widths to the largest.
            // We let the framework determine the appropriate widths, then fix them so that
            // updates to training time remaining don't cause the form to resize.
            int pnlWidth = 0;

            foreach (Control control in mainPanel.Controls)
            {
                if (control.Width > pnlWidth)
                {
                    pnlWidth = control.Width;
                }
            }

            foreach (Control control in mainPanel.Controls)
            {
                if (control is FlowLayoutPanel)
                {
                    FlowLayoutPanel flowPanel = control as FlowLayoutPanel;
                    int             pnlHeight = flowPanel.Height;
                    flowPanel.AutoSize = false;
                    flowPanel.Width    = pnlWidth;
                    flowPanel.Height   = pnlHeight;
                }
            }
            // Position Popup
            TrayIcon.SetToolTipLocation(this);
        }
Example #2
0
        /// <summary>
        /// Updates the tooltip's content.
        /// </summary>
        private void UpdateContent()
        {
            if (!this.Visible)
            {
                m_updatePending = true;
                return;
            }
            m_updatePending = false;

            // Replaces the fragments like "%10546464r" (the number being the character ID) by the remaining time.
            string tooltip = m_tooltipFormat;

            foreach (var character in m_characters)
            {
                var      trainingSkill = character.CurrentlyTrainingSkill;
                TimeSpan remainingTime = trainingSkill.EndTime - DateTime.UtcNow;

                tooltip = Regex.Replace(tooltip,
                                        '%' + character.CharacterID.ToString() + 'r',
                                        Skill.TimeSpanToDescriptiveText(remainingTime, DescriptiveTextOptions.IncludeCommas),
                                        RegexOptions.Compiled);
            }

            // Updates the tooltip and its location
            lblToolTip.Text = tooltip.ToString();
            TrayIcon.SetToolTipLocation(this);
        }
Example #3
0
 /// <summary>
 /// Initialises a new instance of the <see cref="EVEMon.MouseState"/> class with the given trayIcon and mousePosition
 /// </summary>
 /// <param name="trayIcon">The <see cref="EVEMon.TrayIcon"/> whose state is being managed.</param>
 /// <param name="mousePosition">A <see cref="System.Drawing.Point"/> representing the last known mouse location.</param>
 public MouseStateHovering(TrayIcon trayicon, Point mousePosition)
     : base(trayicon, mousePosition)
 {
     // Fire the MouseHover event
     trayIcon.OnMouseHover(new EventArgs());
     // Lock the syncLock to make sure the timer is initialised before mouse events are handled
     lock (syncLock)
     {
         // Start tracking the mouse
         EnableMouseTracking();
         // Start the timer to monitor mouse position
         this.timer = new System.Threading.Timer(new System.Threading.TimerCallback(MouseMonitor), null, 100, System.Threading.Timeout.Infinite);
     }
 }
Example #4
0
 /// <summary>
 /// Initialises a new instance of the <see cref="EVEMon.MouseState"/> class with the given trayIcon and mousePosition
 /// </summary>
 /// <param name="trayIcon">The <see cref="EVEMon.TrayIcon"/> whose state is being managed.</param>
 /// <param name="mousePosition">A <see cref="System.Drawing.Point"/> representing the last known mouse location.</param>
 public MouseStateOver(TrayIcon trayIcon, Point mousePosition)
     : base(trayIcon, mousePosition)
 {
     // Store the existing icon text, then reset it
     trayIcon.iconText        = trayIcon.notifyIcon.Text;
     trayIcon.notifyIcon.Text = "";
     // Start the timer and enable mouse tracking
     // Lock the syncLock since we don't know the timeout value and need to ensure
     // initialisation completes before the timeout occurs
     lock (syncLock)
     {
         // Start the hover timer
         this.timer = new System.Threading.Timer(new System.Threading.TimerCallback(HoverTimeout), null, this.trayIcon.MouseHoverTime, System.Threading.Timeout.Infinite);
         // Start tracking the mouse
         EnableMouseTracking();
     }
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EVEMon.TrayIcon.MouseStateOut"/> class for a given trayIcon.
 /// </summary>
 /// <param name="trayIcon">A <see cref="EVEMon.TrayIcon"/> whose state we are managing.</param>
 public MouseStateOut(TrayIcon trayIcon) : base(trayIcon, new Point(0, 0))
 {
     EnableMouseTracking();
 }
Example #6
0
 /// <summary>
 /// Initialises a new instance of the <see cref="EVEMon.MouseState"/> class with the given trayIcon and mousePosition
 /// </summary>
 /// <param name="trayIcon">The <see cref="EVEMon.TrayIcon"/> whose state is being managed.</param>
 /// <param name="mousePosition">A <see cref="System.Drawing.Point"/> representing the last known mouse location.</param>
 public MouseState(TrayIcon trayIcon, Point mousePosition)
 {
     this.trayIcon      = trayIcon;
     this.mousePosition = mousePosition;
     syncLock           = new Object();
 }