private void buttonPlayerNumberSelecter_Clicked(object sender, EventArgs e) { MyXamarinButton button = (MyXamarinButton)sender; bool isEnabledThatRow = (button == this.radioButtonPlayerSelecter.Button1) ? false : true; this.radioButtonPlayerType4.IsVisible = isEnabledThatRow; this.radioButtonPlayerNameEntry4.IsVisible = isEnabledThatRow; this.radioButtonPlayer4PlaceHolder.IsVisible = !isEnabledThatRow; }
private void _playerTypeSelecter(MyXamarinButton button, MyXamarinTwoOptionRadioButton radioButton, MyXamarinEntry entry, string cpuName) { if (button == radioButton.Button1) { entry.IsEnabled = true; entry.Text = null; entry.Placeholder = ENTRY_PLACEHOLDER_NAME; } else { entry.IsEnabled = false; entry.Text = cpuName; } }
private void buttonPlayerTypeSelecter_Clicked(object sender, EventArgs e) { MyXamarinButton button = (MyXamarinButton)sender; //MyXamarinTwoOptionRadioButton buttonParent = (MyXamarinTwoOptionRadioButton)button.Parent; //string buttonParentName = buttonParent. //parentXName? Reflection off; binding mb later if (button.Parent == this.radioButtonPlayerType1) { this._playerTypeSelecter(button, this.radioButtonPlayerType1, this.radioButtonPlayerNameEntry1, CPU_NAME_1); } else if (button.Parent == this.radioButtonPlayerType2) { this._playerTypeSelecter(button, this.radioButtonPlayerType2, this.radioButtonPlayerNameEntry2, CPU_NAME_2); } else if (button.Parent == this.radioButtonPlayerType3) { this._playerTypeSelecter(button, this.radioButtonPlayerType3, this.radioButtonPlayerNameEntry3, CPU_NAME_3); } else { this._playerTypeSelecter(button, this.radioButtonPlayerType4, this.radioButtonPlayerNameEntry4, CPU_NAME_4); } }