Beispiel #1
0
        /// <summary>
        /// When the menu is about to be opened, reload from the streams file
        /// and update the renderer colors when needed.
        /// </summary>
        private void OnMenuOpening(Object sender, CancelEventArgs e)
        {
            // get the mouse position *before* doing anything
            // because it can move while we are reloading the menu:
            Point position = Util.MousePosition;

            // suspend/resume layout before/after reloading:
            notifyIcon.ContextMenuStrip.SuspendLayout();

            if (streamsFileLoader.MustReload())
            {
                MenuUpdate();
            }

            toolStripRenderer.UpdateColors();

            notifyIcon.ContextMenuStrip.ResumeLayout();
            e.Cancel = false;
            notifyIcon.ShowContextMenuStrip(position);
        }