public MatchDialog() : base() { userNameTextBox = new TextBox() { MaxLength = 10 }; blackButton = new RadioButton() { Text = "Black", Checked = true, Height = userNameTextBox.Height }; whiteButton = new RadioButton() { Text = "White", Height = userNameTextBox.Height }; boardSizeUpDown = new NumericUpDown() { Minimum = 2, Maximum = 19, Value = 19 }; timeUpDown = new NumericUpDown() { Minimum = 0, Maximum = 1000, Value = 30 }; byouyomiUpDown = new NumericUpDown() { Minimum = 0, Maximum = 1000 }; foreach (var item in new Control[] { userNameTextBox, blackButton, whiteButton, boardSizeUpDown, timeUpDown, byouyomiUpDown }) { Layout.Resize(item); } table = Layout.PropertyTable( Layout.Label("Player name:"), userNameTextBox, Layout.Label("Your color:"), blackButton, null, whiteButton, Layout.Label("Board size:"), boardSizeUpDown, Layout.Label("Base time:"), timeUpDown, Layout.Label("Byouyomi:"), byouyomiUpDown); Layout.Bind(table, this); }
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 AccountDialog(IGSAccount account) : base() { var hostTextBox = new TextBox() { Text = account.Server }; var portUpDown = new NumericUpDown() { Minimum = 0, Maximum = UInt16.MaxValue, Value = account.Port }; var nameTextBox = new TextBox() { MaxLength = 10, Text = account.Name }; var passwordTextBox = new TextBox() { PasswordChar = '*', Text = account.Password }; var savePasswordCheckBox = new CheckBox() { Text = "Save Password (plaintext)?", Checked = account.PasswordSpecified }; getAccount = () => new IGSAccount(hostTextBox.Text, Convert.ToInt32(portUpDown.Value), nameTextBox.Text, passwordTextBox.Text, savePasswordCheckBox.Checked); foreach (var item in new Control[] { hostTextBox, portUpDown, nameTextBox, passwordTextBox, savePasswordCheckBox }) { Layout.Resize(item); } Layout.Bind( Layout.PropertyTable( Layout.Label("Host:"), hostTextBox, Layout.Label("Port:"), portUpDown, Layout.Label("Name:"), nameTextBox, Layout.Label("Password:"), passwordTextBox, null, savePasswordCheckBox), this); }
public ToggleDialog(IGSToggleSettings settings) : base() { toggleBoxes = Collection.ToArray(Collection.Map( toggleLabels, s => new CheckBox() { Text = s })); foreach (var item in toggleBoxes) { Layout.Resize(item); } toggleBoxes[0].Checked = settings.Open; toggleBoxes[1].Checked = settings.Looking; toggleBoxes[2].Checked = settings.Kibitz; Layout.Bind(Layout.Stack(toggleBoxes), this); }
public SeekDialog() : base() { boardSizeUpDown = new NumericUpDown() { Minimum = 2, Maximum = 19, Value = 19 }; handicapUpDown = new NumericUpDown() { Minimum = 0, Maximum = 9, Value = 0 }; foreach (var item in new Control[] { boardSizeUpDown, handicapUpDown }) { Layout.Resize(item); } timeRadioButtons = Collection.ToArray(Collection.Map( SeekRequest.TimeLabels, s => new RadioButton() { Text = s, Height = boardSizeUpDown.Height })); var table = new LayoutTable(timeRadioButtons.Length + 1, 1); table.Fill(timeRadioButtons); table.PutLayout(Layout.PropertyTable( Layout.Label("Board size:"), boardSizeUpDown, Layout.Label("Handicap:"), handicapUpDown), timeRadioButtons.Length, 0); table.FixRows(); Layout.Bind(table, this); }
private TabPage CreateNotificationPage() { friendsBox = new CheckBox() { Text = "Friends' state changes", Checked = ConfigManager.Settings.FriendsNotify, }; chatBox = new CheckBox() { Text = "In-game chat messages arrive", Checked = ConfigManager.Settings.ChatNotify, }; soundBox = new CheckBox() { Text = "Enable", Checked = ConfigManager.Settings.Sound }; foreach (var item in new [] { friendsBox, chatBox, soundBox }) { Layout.Resize(item); } var notificationTable = Layout.Stack( Layout.Label("Notify when:"), friendsBox, chatBox, Layout.Label("Sound:"), soundBox); var page = new TabPage() { Text = "Notifications", Dock = DockStyle.Fill }; Layout.Bind(notificationTable, page); return(page); }
private TabPage CreateButtonsPage() { bindings = Collection.ToArray( Collection.Range(4, () => new ComboBox())); var actions = HardwareButtonBindings.GetActions(); var index = 0; foreach (var item in bindings) { Layout.Resize(item); item.Items.Add("None"); foreach (var name in actions) { item.Items.Add(name); } var selected = HardwareButtonBindings.GetBinding(HardwareButtonBindings.Buttons[index]); item.SelectedItem = (selected != string.Empty && item.Items.Contains(selected)) ? selected : "None"; index += 1; } var buttonsTable = Layout.Stack( Layout.Label("Hardware button 1"), bindings[0], Layout.Label("Hardware button 2"), bindings[1], Layout.Label("Hardware button 3"), bindings[2], Layout.Label("Hardware button 4"), bindings[3]); var page = new TabPage() { Text = "Buttons", Dock = DockStyle.Fill }; Layout.Bind(buttonsTable, page); return(page); }
private TabPage CreateAccountPage() { accountsBox = new ListBox(); GetAccounts(accountsBox); addAccountButton = Layout.Button("Add"); editAccountButton = Layout.Button("Edit"); removeAccountButton = Layout.Button("Remove"); addAccountButton.Click += delegate { var dialog = new AccountDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var account = dialog.Account; if (ConfigManager.Settings.Accounts.Find( a => a.Name == account.Name) == null) { ConfigManager.Settings.Accounts.Add(account); accountsBox.Items.Add(account.Name); accountsBox.SelectedItem = account.Name; } } }; editAccountButton.Click += delegate { var index = accountsBox.SelectedIndex; if (index >= 0) { var name = accountsBox.SelectedItem as string; var dialog = new AccountDialog( ConfigManager.Settings.Accounts.Find( a => a.Name == name) ?? IGSAccount.DefaultAccount); if (dialog.ShowDialog() == DialogResult.OK) { var account = dialog.Account; ConfigManager.Settings.Accounts.RemoveAll( a => a.Name == name); ConfigManager.Settings.Accounts.Insert(index, account); accountsBox.Items[index] = account.Name; } } }; removeAccountButton.Click += delegate { var index = accountsBox.SelectedIndex; if (index >= 0) { ConfigManager.Settings.Accounts.RemoveAt(index); accountsBox.Items.RemoveAt(index); if (ConfigManager.Settings.Accounts.Count == 0) { ConfigManager.Settings.Accounts.Add(IGSAccount.DefaultAccount); accountsBox.Items.Add(IGSAccount.DefaultAccount.Name); } if (accountsBox.SelectedIndex < 0) { accountsBox.SelectedIndex = accountsBox.Items.Count - 1; } } }; var accountTable = new LayoutTable(2, 1); accountTable.PutControl(accountsBox, 0, 0); accountTable.PutLayout( Layout.Flow(addAccountButton, editAccountButton, removeAccountButton), 1, 0); accountTable.FixRows(1); var page = new TabPage() { Text = "Account", Dock = DockStyle.Fill }; Layout.Bind(accountTable, page); return(page); }
private TabPage CreateDisplayPage() { fontBox = new ComboBox(); GetFonts(fontBox); encodingBox = new ComboBox(); GetEncodings(encodingBox); gdiButton = new RadioButton() { Text = "GDI", Checked = ConfigManager.Settings.Renderer == RendererType.GDI, }; direct3DButton = new RadioButton() { Text = "Direct3D", Checked = ConfigManager.Settings.Renderer == RendererType.Direct3D, }; textureBox = new CheckBox() { Text = "No textures (GDI only)", Checked = ConfigManager.Settings.NoTextures }; cursorBox = new CheckBox() { Text = "Keep cursor on board", Checked = ConfigManager.Settings.KeepCursor }; moveMarkBox = new CheckBox() { Text = "Use old last move mark", Checked = ConfigManager.Settings.OldMark }; foreach (var item in new Control[] { fontBox, encodingBox, gdiButton, direct3DButton, cursorBox, moveMarkBox, textureBox }) { Layout.Resize(item); } var displayTable = Layout.Stack(null, cursorBox, moveMarkBox, textureBox); displayTable.PutLayout( Layout.PropertyTable( Layout.Label("Font:"), fontBox, Layout.Label("Encoding:"), encodingBox, Layout.Label("Renderer:"), gdiButton, null, direct3DButton), 0, 0); var page = new TabPage() { Text = "Display", Dock = DockStyle.Fill }; Layout.Bind(displayTable, page); return(page); }
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); }