void CreateContextMenu() { gameContext = new NimbusContextMenu(this.Theme); gameContext.Add(new NMenuItem("Play", new EventHandler(btnPlay_Click))); gameContext.Add(new NMenuItem("Configure", new EventHandler(btnSetup_Click))); gameContext.Add(new NMenuItem("Favourite", new EventHandler(btnFavourite_Click))); gameContext.Add(new NMenuItem("-")); gameContext.Add(new NMenuItem("Delete", new EventHandler(btnDelete_Click))); lst.ContextMenu = gameContext; }
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(); } }