Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3.  
  4. namespace ankietav2
  5. {
  6.  
  7. public partial class Form1 : Form
  8. {
  9. readonly string[] questions = { "Czy jesteś dziś wyspany?", "Czy masz poczucie nadciągającej zagłady?","Czy twoja podróż do pracy/szkoły była spokojna?","Czy jesteś zadowolony z obecnej sytuacji politycznej w Polsce?",
  10. "Jak określiłbyś swoje dzisiejsze nastawienie do świata?","W ilu procentach uważasz swój dzień za satysfakcjonujący?" ,"Czy ktoś wyprowadził cię dziś z równowagi?","Czy czujesz nostalgię za minionymi zdażeniami?",
  11. "Czy sam fakt fakt wypełnienienia ankiety zdenerwował cię?"};
  12. readonly string[] answer = { "Tak","Nie" };
  13. readonly string[] otherAnswer = { "100%-70%", "60%-40%", "30%-0%" };
  14. readonly string[] theLastAnswers = { "Pozytywne", "Neutralne", "Negatywne" };
  15. int sorrow = 0;
  16. int happines = 0;
  17. int rage = 0;
  18. int i = 0;
  19. string setColor;
  20. string setEmotions;
  21. int numberOfQuestion = 1;
  22. forma2 form;
  23.  
  24. public Form1()
  25. {
  26. InitializeComponent();
  27. finish.Visible = false;
  28. questionsLabel.Text = "Pytanie " + numberOfQuestion + ". " + questions[0];
  29.  
  30. radioButton1.Text = answer[0];
  31. radioButton2.Text = answer[1];
  32. radioButton3.Visible = false;
  33. }
  34.  
  35. private void NextQuestions_Click(object sender, EventArgs e)
  36. {
  37. test(i);
  38. i++;
  39. radioButton1.Text = answer[0];
  40. radioButton2.Text = answer[1]; radioButton1.Checked = false;
  41. radioButton2.Checked = false;
  42. radioButton3.Checked = false;
  43. radioButton3.Visible = false;
  44. if(i==5)
  45. {
  46. radioButton1.Text = otherAnswer[0];
  47. radioButton2.Text = otherAnswer[1];
  48. radioButton3.Text = otherAnswer[2];
  49. radioButton3.Visible = true;
  50. }
  51. if (i == 4)
  52. {
  53. radioButton1.Text = theLastAnswers[0];
  54. radioButton2.Text = theLastAnswers[1];
  55. radioButton3.Text = theLastAnswers[2];
  56. radioButton3.Visible = true;
  57. }
  58. if (i == questions.Length)
  59. {
  60. questionsLabel.Text = "Dziękujemy za wypełnienie ankiety.";
  61. NextQuestions.Visible = false;
  62. finish.Visible = true;
  63. radioButton1.Visible = false;
  64. radioButton2.Visible = false;
  65. }
  66. else
  67. {
  68. questionsLabel.Text = "Pytanie " + numberOfQuestion + ". " + questions[i];
  69. numberOfQuestion++;
  70. }
  71. }
  72. public void test(int i)
  73. {
  74. if (i == 0 || 1 < i && i < 6)
  75. {
  76. if(radioButton1.Checked == true)
  77. {
  78. happines += 5;
  79. }
  80. if(radioButton2.Checked == true)
  81. {
  82. sorrow += 5;
  83. }
  84. }
  85. if (i == 1 && radioButton1.Checked == true)
  86. {
  87. sorrow += 10;
  88. }
  89. if (i == 6 && radioButton1.Checked == true)
  90. {
  91. rage += 20;
  92. }
  93. if (i == 7 && radioButton1.Checked == true)
  94. {
  95. sorrow += 10;
  96. }
  97. if (i == 8 && radioButton1.Checked == true)
  98. {
  99. rage += 20;
  100. }
  101.  
  102. }
  103.  
  104. private void finish_Click(object sender, EventArgs e)
  105. {
  106. if (happines > sorrow)
  107. {
  108. if (happines > rage)
  109. {
  110. setEmotions = "Dzis masz dobry humor !!!";
  111. setColor = "Blue";
  112. form = new forma2(Properties.Resources.happiness, setEmotions, setColor);
  113. form.ShowDialog();
  114. }
  115. else
  116. {
  117. setEmotions = "Jesteś wsciekły!!!";
  118. setColor = "Red";
  119. form = new forma2(Properties.Resources.rage, setEmotions, setColor);
  120. form.ShowDialog();
  121. }
  122. }
  123. else
  124. {
  125. if (sorrow == 0)
  126. {
  127. setEmotions = "Nie udało ci się zaznaczyć żadnej odpowiedzi ,Pepe jest zawiedzony";
  128. setColor = "Blue";
  129. form = new forma2(Properties.Resources.zero, setEmotions, setColor);
  130. form.ShowDialog();
  131. }
  132. else
  133. {
  134. setEmotions = "Jesteś smutny";
  135. setColor = "Black";
  136. form = new forma2(Properties.Resources.sorrow1, setEmotions, setColor);
  137. form.ShowDialog();
  138. }
  139. }
  140. }
  141.  
  142.  
  143. }
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement