void MenuAdjustTeamScoreClick(object sender, EventArgs e) { double a = GameTeam.Adjustment == 0 ? -1000 : GameTeam.Adjustment; if (InputDialog.GetDouble("Adjustment", "Set team score adjustment", ref a)) { GameTeam.Adjustment = a; } Recalculate(false); }
public static Boolean UpdateInput(string title, string message, ref string response) { var id = new InputDialog(title, message, response); Boolean b = (id.ShowDialog() == DialogResult.OK); if (b) { response = id.Response; } return(b); }
void ButtonRenameTeamClick(object sender, EventArgs e) { if (treeView1.SelectedNode.Tag is LeagueTeam) { string name = ((LeagueTeam)treeView1.SelectedNode.Tag).Name; if (InputDialog.UpdateInput("Rename Team", "Choose a new name for the team", ref name)) { ((LeagueTeam)treeView1.SelectedNode.Tag).Name = name; treeView1.SelectedNode.Text = name; } } }
public static bool GetDouble(string title, string message, ref double response) { var id = new InputDialog(title, message); id.SetNumeric((decimal)response); Boolean b = (id.ShowDialog() == DialogResult.OK); if (b) { response = (int)id.numericUpDown1.Value; } return(b); }
void ButtonAddTeamClick(object sender, EventArgs e) { string name = null; if (InputDialog.ConditionalInput("Add Team", "Choose a name for the new team", ref name)) { var team = new LeagueTeam(); team.Name = name; League.AddTeam(team); var node = new TreeNode(name); node.Tag = team; treeView1.Nodes.Add(node); treeView1.SelectedNode = node; } }
void ButtonRenameLeagueClick(object sender, EventArgs e) { League.Title = InputDialog.GetInput("Rename League", "Choose a new name for the league", League.Title); Text = "Torn -- " + League.Title; }
void MenuNameTeamClick(object sender, EventArgs e) { LeagueTeam.Name = InputDialog.GetInput("Name: ", "Set a team name", LeagueTeam.Name); ListView.Columns[1].Text = LeagueTeam == null ? "Players" : LeagueTeam.Name; }
void MenuHandicapTeamClick(object sender, EventArgs e) { Handicap.Value = InputDialog.GetDouble("Handicap", "Set team handicap (" + League.HandicapStyle.ToString() + ")", Handicap.Value); Recalculate(false); }
void MenuAdjustVictoryPointsClick(object sender, EventArgs e) { GameTeam.PointsAdjustment = (double)InputDialog.GetDouble("Victory Points Adjustment", "Set team victory points adjustment", GameTeam.PointsAdjustment); Recalculate(false); }
public static string GetInput(string title, string message, string defaultResponse = "") { var id = new InputDialog(title, message, defaultResponse); return(id.ShowDialog() == DialogResult.OK ? id.Response : defaultResponse); }