private void FillInformation() { Information.Clear(); var id = 0; for (var row = 0; row < m_Game.RowsCount; row++) { for (var column = 0; column < m_Game.ColumnsCount; column++) { int hint = m_Game.GetHintFor(row, column); var info = new PlayingFieldInformation { Id = id++, Hint = hint, Row = row, Column = column, IsSelected = false, DisplayText = ".", BackgroundResource = Resource.Drawable.AtSea }; Information.Add(info); } } }
private void OnHintButtonClick(object sender, EventArgs e) { var button = sender as Button; if ((button == null) || ValidateButtonClick(button)) { return; } PlayingFieldInformation information = Information [button.Id]; if (information.Hint == -1) { button.SetBackgroundResource(Resource.Drawable.MineExplosion); button.SetText(Resource.String.Boom); } else { button.Text = information.Hint.ToString(); } PlayOneRound(information.Row, information.Column); }
public override View GetView(int position, View convertView, ViewGroup parent) { View view = convertView ?? m_Activity.LayoutInflater.Inflate(Resource.Layout.PlayingFieldItem, parent, false); var button = view.FindViewById <Button>(Resource.Id.DisplayFieldButton); if (button != null) { PlayingFieldInformation information = Information [position]; button.SetBackgroundResource(information.BackgroundResource); button.Click += OnHintButtonClick; button.Id = position; button.Text = information.DisplayText; } return(view); }