public GameInfoDialog(GameInfo info, bool editBoardSize) { if (editBoardSize) { boardSizeUpDown = new NumericUpDown() { Minimum = 2, Maximum = 19, Value = 19, }; } whitePlayerTextBox = new TextBox() { Text = info.WhitePlayer }; blackPlayerTextBox = new TextBox() { Text = info.BlackPlayer }; handicapUpDown = new NumericUpDown() { Minimum = 0, Maximum = 100, Value = info.Handicap, }; komiTextBox = new TextBox() { Text = ConfigManager.FloatToString(info.Komi) }; foreach (var item in new Control[] { boardSizeUpDown, whitePlayerTextBox, blackPlayerTextBox, handicapUpDown, komiTextBox }) { Layout.Resize(item); } Layout.Bind( Layout.PropertyTable( editBoardSize ? Layout.Label("Board size") : null, boardSizeUpDown, Layout.Label("White"), whitePlayerTextBox, Layout.Label("Black"), blackPlayerTextBox, Layout.Label("Handicap"), handicapUpDown, Layout.Label("Komi"), komiTextBox), this); }
public GnuGoDialog(GnuGoSettings defaults, bool resume) { boardSizeUpDown = new NumericUpDown() { Minimum = 5, Maximum = 19, Value = defaults.BoardSize, Enabled = !resume }; handicapUpDown = new NumericUpDown() { Minimum = 0, Maximum = 9, Value = defaults.Handicap, Enabled = !resume }; komiTextBox = new TextBox() { Text = ConfigManager.FloatToString(defaults.Komi), Enabled = !resume }; gnugoLevel = new TrackBar() { Minimum = 0, Maximum = 10, Value = defaults.Level }; gnugoBlack = new RadioButton() { Text = "Black", Checked = defaults.Color == GnuGoColor.Black }; gnugoWhite = new RadioButton() { Text = "White", Checked = defaults.Color == GnuGoColor.White }; gnugoBoth = new RadioButton() { Text = "Both", Checked = defaults.Color == GnuGoColor.Both }; gnugoNone = new RadioButton() { Text = "None", Checked = defaults.Color == GnuGoColor.None }; foreach (var item in new Control[] { boardSizeUpDown, komiTextBox, handicapUpDown, gnugoLevel, gnugoBlack, gnugoWhite, gnugoBoth, gnugoNone }) { Layout.Resize(item); } Layout.Bind( Layout.PropertyTable( Layout.Label("Board size"), boardSizeUpDown, Layout.Label("Handicap"), handicapUpDown, Layout.Label("Komi"), komiTextBox, Layout.Label("GNU Go Level"), gnugoLevel, Layout.Label("GNU Go Plays"), gnugoBlack, null, gnugoWhite, null, gnugoBoth, null, gnugoNone), this); }