private void CreateButton() { SetRowAndColDefinition(); for (int i = 0; i < bomb.Length; i++) { var mineButton = new ToggleButton(); mineButton.Name = CommonMethod.UseStringBuilder("mine", i.ToString()); mineButton.Tag = i; mineButton.FontSize = 14; mineButton.FontWeight = FontWeights.Bold; mineButton.Background = Brushes.Beige; if (bomb[i].ToString() == "9") { mineButton.Click += BtnOnClickForMine; } else { mineButton.Checked += BtnOnCheckedForBtn; mineButton.Click += BtnOnClickForBtn; } mineButton.MouseRightButtonDown += BtnOnCheckForMine; mineButton.Unchecked += BtnOnUnChecked; Grid.SetRow(mineButton, i / optionEntity.vNumForButton); Grid.SetColumn(mineButton, i % optionEntity.vNumForButton); mainGrid.Children.Add(mineButton); } }
private void SetBombText(int num) { string strTmp = string.Empty; currentBombNum += num; strTmp = Convert.ToString(currentBombNum); if (strTmp.Length == 1) { textBlock1.Text = CommonMethod.UseStringBuilder("0", "0", strTmp); } else if (strTmp.Length == 1) { textBlock1.Text = CommonMethod.UseStringBuilder("0", strTmp); } else { textBlock1.Text = strTmp; } }
private void GetOptionValue() { frmOption.Owner = Window.GetWindow(this); if (optionEntity == null) { optionEntity = new OptionEntity(); } frmOption.SetOptionEntity(optionEntity); frmOption.ShowDialog(); if (optionEntity.isContinue) { lblLevel.Content = CommonMethod.UseStringBuilder("Level : ", optionEntity.difficultyType, " Class"); currentBombNum = optionEntity.numForMine; SetBombText(0); GameStart(); } }