private void createFourthPage() { fourthPageGrid.Children.Add(fourthPageLabel); specialTaskBonusesTableLabel = new Label[lastAmountSpecialTask]; specialTaskBonusesTableTextBox = new TextBox[lastAmountSpecialTask]; for (int i = 0, positionX = 0; i < lastAmountSpecialTask; i++, positionX++) { if (specialTaskNameTableTextBox != null && specialTaskNameTableTextBox[i].Text != "") { specialTaskBonusesTableLabel[i] = AddControl.addLabel(150, 25, widthMovement + positionX * widthJumpMovement, heightMovement + i / numberOfColumnsSpecialTask * heightJumpMovement, 0, 0, specialTaskNameTableTextBox[i].Text); } else { specialTaskBonusesTableLabel[i] = AddControl.addLabel(70, 25, widthMovement + positionX * widthJumpMovement, heightMovement + i / numberOfColumnsSpecialTask * heightJumpMovement, 0, 0, "Zadanie " + (i + 1).ToString()); } fourthPageGrid.Children.Add(specialTaskBonusesTableLabel[i]); specialTaskBonusesTableTextBox[i] = AddControl.addTextBox(50, 20, widthLabelMovement + positionX * widthJumpMovement + 30, heightMovement + i / numberOfColumnsSpecialTask * heightJumpMovement, 0, 0, "0"); specialTaskBonusesTableTextBox[i].PreviewTextInput += new TextCompositionEventHandler(isNumber); specialTaskBonusesTableTextBox[i].GotFocus += new RoutedEventHandler(gotFocus); specialTaskBonusesTableTextBox[i].LostFocus += new RoutedEventHandler(textBoxLostFocus); specialTaskBonusesTableTextBox[i].PreviewKeyUp += new KeyEventHandler(deleteZero); specialTaskBonusesTableTextBox[i].MaxLength = 2; specialTaskBonusesTableTextBox[i].MaxLines = 1; fourthPageGrid.Children.Add(specialTaskBonusesTableTextBox[i]); if (positionX == numberOfColumnsSpecialTask - 1) { positionX = -1; } } mainGrid.Children.Add(fourthPageGrid); }
private void createSpecialTaskCheckBox() { const int shiftWidth = 50; const int fieldInWidth = 5; const int sizeFieldWidth = 85; const int sizeFielsHeight = 70; specialTaskGrid.Height = sizeFielsHeight * (((PropertiesStalking.numberOfSpecialTask - 1) / fieldInWidth) + 1); Height = 370 + specialTaskGrid.Height; for (int i = 0; i < PropertiesStalking.numberOfSpecialTask; i++) { specialTaskTableLabel[i] = AddControl.addLabel(sizeFieldWidth - 5, 25, (i % fieldInWidth) * sizeFieldWidth + shiftWidth, (i / fieldInWidth) * sizeFielsHeight + 1, 0, 0, PropertiesStalking.specialTaskNames[i]); specialTaskTableLabel[i].ToolTip = PropertiesStalking.specialTaskNames[i]; specialTaskGrid.Children.Add(specialTaskTableLabel[i]); specialTaskTableCheckBox[i] = AddControl.addCheckBox((i % fieldInWidth) * sizeFieldWidth + shiftWidth + 25, (i / fieldInWidth) * sizeFielsHeight + 30, 0, 0); specialTaskTableCheckBox[i].ToolTip = "Bonifikata czasowa: " + PropertiesStalking.bonusesSpecialTask[i].ToString() + " minut"; specialTaskGrid.Children.Add(specialTaskTableCheckBox[i]); if (team.SpecialTask[i]) { specialTaskTableCheckBox[i].IsChecked = true; } else { specialTaskTableCheckBox[i].IsChecked = false; } } }
private void generateControl() { tableLabel = new Label[PropertiesStalking.numberOfTeam, 3]; int i = 0; foreach (Team team in table) { if (team.OverallTime != 0) { tableLabel[i, 0] = AddControl.addLabel(30, 25, 90, i * 35 + 10, 0, 0, (i + 1).ToString()); tableLabel[i, 1] = AddControl.addLabel(250, 25, 0, i * 35 + 10, 0, 0, team.TeamName); tableLabel[i, 2] = AddControl.addLabel(40, 25, 0, i * 35 + 10, 85, 0, team.OverallTime.ToString()); tableLabel[i, 1].HorizontalAlignment = HorizontalAlignment.Center; tableLabel[i, 1].FontWeight = FontWeights.Bold; scoreGrid.Children.Add(tableLabel[i, 0]); scoreGrid.Children.Add(tableLabel[i, 1]); scoreGrid.Children.Add(tableLabel[i, 2]); i++; } scoreGrid.Height = 35 * (i + 1) + 30; Height = scoreGrid.Height + titleGrid.Height; } }
private void createThirdPage() { thirdPageGrid.Children.Add(thirdPageLabel); specialTaskNameTableLabel = new Label[lastAmountSpecialTask]; specialTaskNameTableTextBox = new TextBox[lastAmountSpecialTask]; for (int i = 0, positionX = 0; i < lastAmountSpecialTask; i++, positionX++) { specialTaskNameTableLabel[i] = AddControl.addLabel(70, 25, widthMovement + positionX * widthJumpMovement, heightMovement + i / numberOfColumnsSpecialTask * heightJumpMovement, 0, 0, "Zadanie " + (i + 1).ToString()); thirdPageGrid.Children.Add(specialTaskNameTableLabel[i]); specialTaskNameTableTextBox[i] = AddControl.addTextBox(180, 20, widthLabelMovement + positionX * widthJumpMovement, heightMovement + i / numberOfColumnsSpecialTask * heightJumpMovement, 0, 0, ""); specialTaskNameTableTextBox[i].ToolTip = "W przypadku pozostawienia pustego pola, zostanie nadana nazwa domyślna"; specialTaskNameTableTextBox[i].MaxLines = 1; specialTaskNameTableTextBox[i].MaxLength = 50; thirdPageGrid.Children.Add(specialTaskNameTableTextBox[i]); if (positionX == numberOfColumnsSpecialTask - 1) { positionX = -1; } } mainGrid.Children.Add(thirdPageGrid); }
private void createSecondPage() { secondPageGrid.Children.Add(secondPageLabel); teamNamesTableLabel = new Label[lastAmountTeam]; teamNamesTableTextBox = new TextBox[lastAmountTeam]; for (int i = 0, positionX = 0; i < lastAmountTeam; i++, positionX++) { teamNamesTableLabel[i] = AddControl.addLabel(70, 25, widthMovement + positionX * widthJumpMovement, heightMovement + i / numberOfColumnsTeam * heightJumpMovement, 0, 0, "Drużyna " + (i + 1).ToString()); secondPageGrid.Children.Add(teamNamesTableLabel[i]); teamNamesTableTextBox[i] = AddControl.addTextBox(180, 20, widthLabelMovement + positionX * widthJumpMovement, heightMovement + i / numberOfColumnsTeam * heightJumpMovement, 0, 0, ""); teamNamesTableTextBox[i].ToolTip = "W przypadku pozostawienia pustego pola, zostanie nadana nazwa domyślna"; teamNamesTableTextBox[i].MaxLength = 40; teamNamesTableTextBox[i].MaxLines = 1; secondPageGrid.Children.Add(teamNamesTableTextBox[i]); if (positionX == numberOfColumnsTeam - 1) { positionX = -1; } } mainGrid.Children.Add(secondPageGrid); }