Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- namespace ankietav2
- {
- public partial class Form1 : Form
- {
- 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?",
- "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?",
- "Czy sam fakt fakt wypełnienienia ankiety zdenerwował cię?"};
- readonly string[] answer = { "Tak","Nie" };
- readonly string[] otherAnswer = { "100%-70%", "60%-40%", "30%-0%" };
- readonly string[] theLastAnswers = { "Pozytywne", "Neutralne", "Negatywne" };
- int sorrow = 0;
- int happines = 0;
- int rage = 0;
- int i = 0;
- string setColor;
- string setEmotions;
- int numberOfQuestion = 1;
- forma2 form;
- public Form1()
- {
- InitializeComponent();
- finish.Visible = false;
- questionsLabel.Text = "Pytanie " + numberOfQuestion + ". " + questions[0];
- radioButton1.Text = answer[0];
- radioButton2.Text = answer[1];
- radioButton3.Visible = false;
- }
- private void NextQuestions_Click(object sender, EventArgs e)
- {
- test(i);
- i++;
- radioButton1.Text = answer[0];
- radioButton2.Text = answer[1]; radioButton1.Checked = false;
- radioButton2.Checked = false;
- radioButton3.Checked = false;
- radioButton3.Visible = false;
- if(i==5)
- {
- radioButton1.Text = otherAnswer[0];
- radioButton2.Text = otherAnswer[1];
- radioButton3.Text = otherAnswer[2];
- radioButton3.Visible = true;
- }
- if (i == 4)
- {
- radioButton1.Text = theLastAnswers[0];
- radioButton2.Text = theLastAnswers[1];
- radioButton3.Text = theLastAnswers[2];
- radioButton3.Visible = true;
- }
- if (i == questions.Length)
- {
- questionsLabel.Text = "Dziękujemy za wypełnienie ankiety.";
- NextQuestions.Visible = false;
- finish.Visible = true;
- radioButton1.Visible = false;
- radioButton2.Visible = false;
- }
- else
- {
- questionsLabel.Text = "Pytanie " + numberOfQuestion + ". " + questions[i];
- numberOfQuestion++;
- }
- }
- public void test(int i)
- {
- if (i == 0 || 1 < i && i < 6)
- {
- if(radioButton1.Checked == true)
- {
- happines += 5;
- }
- if(radioButton2.Checked == true)
- {
- sorrow += 5;
- }
- }
- if (i == 1 && radioButton1.Checked == true)
- {
- sorrow += 10;
- }
- if (i == 6 && radioButton1.Checked == true)
- {
- rage += 20;
- }
- if (i == 7 && radioButton1.Checked == true)
- {
- sorrow += 10;
- }
- if (i == 8 && radioButton1.Checked == true)
- {
- rage += 20;
- }
- }
- private void finish_Click(object sender, EventArgs e)
- {
- if (happines > sorrow)
- {
- if (happines > rage)
- {
- setEmotions = "Dzis masz dobry humor !!!";
- setColor = "Blue";
- form = new forma2(Properties.Resources.happiness, setEmotions, setColor);
- form.ShowDialog();
- }
- else
- {
- setEmotions = "Jesteś wsciekły!!!";
- setColor = "Red";
- form = new forma2(Properties.Resources.rage, setEmotions, setColor);
- form.ShowDialog();
- }
- }
- else
- {
- if (sorrow == 0)
- {
- setEmotions = "Nie udało ci się zaznaczyć żadnej odpowiedzi ,Pepe jest zawiedzony";
- setColor = "Blue";
- form = new forma2(Properties.Resources.zero, setEmotions, setColor);
- form.ShowDialog();
- }
- else
- {
- setEmotions = "Jesteś smutny";
- setColor = "Black";
- form = new forma2(Properties.Resources.sorrow1, setEmotions, setColor);
- form.ShowDialog();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement