protected override void OnMouseDown([NotNull] MouseEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } base.OnMouseDown(e); Battle battle = GetBattle(e.X, e.Y); if (e.Button == MouseButtons.Left) { if (battle != null) { if (battle.IsPassworded) { // hack dialog Program.FormMain using (var form = new AskBattlePasswordForm(battle.Founder.Name)) if (form.ShowDialog() == DialogResult.OK) { ActionHandler.JoinBattle(battle.BattleID, form.Password); } } else { ActionHandler.JoinBattle(battle.BattleID, null); } } else if (OpenGameButtonHitTest(e.X, e.Y)) { ShowHostDialog(KnownGames.GetDefaultGame()); } } else if (e.Button == MouseButtons.Right) { var cm = ContextMenus.GetBattleListContextMenu(battle); Program.ToolTip.Visible = false; try { cm.Show(Parent, e.Location); } catch (Exception ex) { Trace.TraceError("BattleListControl Error displaying tooltip: {0}", ex); } finally { Program.ToolTip.Visible = true; } } }
protected override void OnMouseDown([NotNull] MouseEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } base.OnMouseDown(e); Battle battle = GetBattle(e.X, e.Y); if (e.Button == MouseButtons.Left) { if (battle != null) { if (battle.IsPassworded) { // hack dialog Program.FormMain using (var form = new AskBattlePasswordForm(battle.Founder.Name)) if (form.ShowDialog() == DialogResult.OK) { ActionHandler.JoinBattle(battle.BattleID, form.Password); } } else { ActionHandler.JoinBattle(battle.BattleID, null); } } else if (OpenGameButtonHitTest(e.X, e.Y)) { ShowHostDialog(KnownGames.GetDefaultGame()); } } else if (e.Button == MouseButtons.Right) { // todo - disable OnMouseMove while this is open to stop battle tooltips floating under it ContextMenus.GetBattleListContextMenu(battle).Show(Parent, e.Location); Program.ToolTip.Visible = false; } }