//----------------------------------------CREATING THE BOARD------------------------------------------\\ // initialises the board by adding the array of buttons void initBoard() { Random r = new Random(); // nested for loop that initialises an array of buttons for (int x = 0; x < btn.GetLength(0); x++) { for (int y = 0; y < btn.GetLength(1); y++) { // creates new button object btn[x, y] = new Button(); // sets dimentions and position of buttons btn[x, y].SetBounds(60 * x, (60 * y) + 25, 60, 60); btn[x, y].FlatStyle = FlatStyle.Flat; btn[x, y].FlatAppearance.BorderColor = Color.FromArgb(17, 47, 65); // generates a random number between 0 and 3 int colorNum = r.Next(4); if (colorNum == 0) { // changes colour of button to red btn[x, y].BackColor = Color.Red; } else if (colorNum == 1) { // changes colour of button to blue btn[x, y].BackColor = Color.Blue; } else if (colorNum == 2) { // changes colour of button to green btn[x, y].BackColor = Color.Green; } else if (colorNum == 3) { // changes colour of button to yellow btn[x, y].BackColor = Color.Yellow; } //creates button click event handler btn[x, y].Click += new EventHandler(this.btnEvent_Click); // adds buttons to gui Controls.Add(btn[x, y]); multiLbl.Hide(); timeLbl.Hide(); scoreLabel.Hide(); plus2Lbl.Hide(); turnLbl.Hide(); CountdownLbl.Hide(); boardHomeBtn.Hide(); TitleLbl.Hide(); P1ScoreLbl.Hide(); P2ScoreLbl.Hide(); } } }
void SetTexts() { TitleLbl.SetAttributedText(QuestionnaireViewModel.REGISTER_QUESTIONAIRE_HEADER); SubtitleLbl.SetAttributedText(QuestionnaireViewModel.REGISTER_QUESTIONAIRE_SYMPTOMONSET_TEXT); YesLbl.SetAttributedText(QuestionnaireViewModel.REGISTER_QUESTIONAIRE_SYMPTOMONSET_ANSWER_YES, StyleUtil.FontType.FontBold); YesButLbl.SetAttributedText(QuestionnaireViewModel.REGISTER_QUESTIONAIRE_SYMPTOMONSET_ANSWER_YESBUT, StyleUtil.FontType.FontBold); NoLbl.SetAttributedText(QuestionnaireViewModel.REGISTER_QUESTIONAIRE_SYMPTOMONSET_ANSWER_NO, StyleUtil.FontType.FontBold); SkipLbl.SetAttributedText(QuestionnaireViewModel.REGISTER_QUESTIONAIRE_SYMPTOMONSET_ANSWER_SKIP, StyleUtil.FontType.FontBold); UpdateDateLbl(QuestionnaireViewModel.DateLabel); }
//hides the main menu void hideMenu() { ClassicBtn.Hide(); ExitBtn.Hide(); HelpBtn.Hide(); TimeBtn.Hide(); multiplayerBtn.Hide(); menuBack.Hide(); HomeTLbl.Hide(); boardHomeBtn.Show(); TitleLbl.Show(); if (gameMode == 2) { P1ScoreLbl.Show(); P2ScoreLbl.Show(); turnLbl.Show(); } }
//shows the main menu void showMenu() { ClassicBtn.Invoke(new Action(() => ClassicBtn.Show())); ExitBtn.Invoke(new Action(() => ExitBtn.Show())); HelpBtn.Invoke(new Action(() => HelpBtn.Show())); multiplayerBtn.Invoke(new Action(() => multiplayerBtn.Show())); TimeBtn.Invoke(new Action(() => TimeBtn.Show())); menuBack.Invoke(new Action(() => menuBack.Show())); HomeTLbl.Invoke(new Action(() => HomeTLbl.Show())); boardHomeBtn.Invoke(new Action(() => boardHomeBtn.Hide())); CountdownLbl.Invoke(new Action(() => CountdownLbl.Hide())); TitleLbl.Invoke(new Action(() => TitleLbl.Hide())); if (gameMode == 2) { P1ScoreLbl.Invoke(new Action(() => P1ScoreLbl.Hide())); P2ScoreLbl.Invoke(new Action(() => P2ScoreLbl.Hide())); turnLbl.Invoke(new Action(() => turnLbl.Hide())); } }
void ReleaseDesignerOutlets() { if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (DateContainer != null) { DateContainer.Dispose(); DateContainer = null; } if (DateLbl != null) { DateLbl.Dispose(); DateLbl = null; } if (DatePicker != null) { DatePicker.Dispose(); DatePicker = null; } if (DatepickerStackView != null) { DatepickerStackView.Dispose(); DatepickerStackView = null; } if (InfoButton != null) { InfoButton.Dispose(); InfoButton = null; } if (NextBtn != null) { NextBtn.Dispose(); NextBtn = null; } if (NoBtn != null) { NoBtn.Dispose(); NoBtn = null; } if (NoLargeBtn != null) { NoLargeBtn.Dispose(); NoLargeBtn = null; } if (NoLbl != null) { NoLbl.Dispose(); NoLbl = null; } if (SkipBtn != null) { SkipBtn.Dispose(); SkipBtn = null; } if (SkipLargeBtn != null) { SkipLargeBtn.Dispose(); SkipLargeBtn = null; } if (SkipLbl != null) { SkipLbl.Dispose(); SkipLbl = null; } if (SubtitleLbl != null) { SubtitleLbl.Dispose(); SubtitleLbl = null; } if (TitleLbl != null) { TitleLbl.Dispose(); TitleLbl = null; } if (YesButBtn != null) { YesButBtn.Dispose(); YesButBtn = null; } if (YesButLargeBtn != null) { YesButLargeBtn.Dispose(); YesButLargeBtn = null; } if (YesButLbl != null) { YesButLbl.Dispose(); YesButLbl = null; } if (YesLbl != null) { YesLbl.Dispose(); YesLbl = null; } if (YesSinceBtn != null) { YesSinceBtn.Dispose(); YesSinceBtn = null; } if (YesSinceLargeBtn != null) { YesSinceLargeBtn.Dispose(); YesSinceLargeBtn = null; } }