Example #1
0
 void notifyIcon_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         WindowState = FormWindowState.Normal;
         if (!Visible)
         {
             NativeMethods.AnimateWindow(this.Handle, 200, (int)NativeMethods.AnimateWindowFlags.AW_BLEND | (int)NativeMethods.AnimateWindowFlags.AW_ACTIVATE);
             Show();
         }
         this.Focus();
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         notifyIconContext = new NimbusContextMenu(Theme);
         foreach (Game g in Factory.Games.LastFive)
         {
             notifyIconContext.Add(new NMenuItem(g.Title, new EventHandler(Game_Click), g));
         }
         if (Factory.Games.LastFive.Count > 0)
         {
             notifyIconContext.Add(new NMenuItem("-"));
         }
         notifyIconContext.Add(new NMenuItem("Online Library", new EventHandler(btnLibrary_Clicked)));
         notifyIconContext.Add(new NMenuItem("Collection", new EventHandler(btnGames_Clicked)));
         notifyIconContext.Add(new NMenuItem("-"));
         notifyIconContext.Add(new NMenuItem("Exit", new EventHandler(Exit_Click)));
         notifyIconContext.ShowMenu();
     }
 }
Example #2
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            int index = (e.Y + (int)offset) / 56;

            if (index + 1 > games.Count)
            {
                return;
            }
            int oldindex = selectedIndex;

            //if (index == oldindex) return;
            selectedIndex = index;
            OnItemChange();
            Invalidate();
            Update();
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                ContextMenu.ShowMenu();
            }
            base.OnMouseClick(e);
        }