Exemplo n.º 1
0
        private void OnClick(object sender, System.EventArgs e)
        {
            if (sender is System.Windows.Forms.Button)
            {
                System.Drawing.Color highlighting_color = Color.FromName(Globals.BUTTON_BACKGROUND_OK);

                switch (((System.Windows.Forms.Button)sender).Name)
                {
                    case "menu":

                        Globals.newGame = false;
                        HomePage pagIniz = new HomePage();
                        this.Close();
                        pagIniz.ShowDialog();

                        break;

                    case "si": 


                        si.BackColor = highlighting_color;
                        no.BackColor = Color.FromName(Globals.BUTTON_BACKGROUND);

                        risUtente = "si";

                        this.ok_1.Click += new System.EventHandler(this.OnClick);

                        break;

		    case "no": 

                        no.BackColor = highlighting_color;
                        si.BackColor = Color.FromName(Globals.BUTTON_BACKGROUND);

                        risUtente = "no";
                        this.ok_1.Click += new System.EventHandler(this.OnClick);

                        break;

                    case "ok_1":

                        if(page == 1)
                        {
                            if (risUtente == "si")
                            {
                                smile.Visible = true;
                                nosmile.Visible = false;
                                smile2.Visible = false;
                                nosmile2.Visible = false;

                                pagina_ok = true;
                            }

                            else if (risUtente == "no")
                            {
                                nosmile.Visible = true;
                                smile.Visible = false;
                                smile2.Visible = false;
                                nosmile2.Visible = false;

                                pagina_ok = false;
                            }
                        }

                        break;

                    case "ok_2":

                        spesa = Globals.soldiPrima - Globals.soldiDopo;
                        guadagno = Globals.soldiDopoVendita - Globals.soldiPrima + Globals.soldiDopo;
                        val_4 = Val_porta_4();

                        if(page == 2)
                        {
                            if(spesa == val_4)
                            {
                                ok_2.Visible = false;
                                testo.Visible = true; //XXXXXX false;
                                ok_3.Visible = true;
                                testo2.Visible = true;
                                risposta.Visible = true;
                                smile.Visible = true;
                                nosmile.Visible = false;
                                smile2.Visible = false;
                                nosmile2.Visible = false;
                            }

                            else
                            {
                                nosmile.Visible = true;
                                smile.Visible = false;
                                smile2.Visible = false;
                                nosmile2.Visible = false;
                            }
                        }
			else if(page == 3)
                        {
                            if(guadagno == val_4)
                            {
                                ok_2.Visible = false;
                                testo.Visible = true; //XXXXXX false;
                                ok_3.Visible = true;
                                testo2.Visible = true;
                                risposta.Visible = true;
                                smile.Visible = true;
                                nosmile.Visible = false;
                                smile2.Visible = false;
                                nosmile2.Visible = false;
                            }

                            else
                            {
                                nosmile.Visible = true;
                                smile.Visible = false;
                                smile2.Visible = false;
                                nosmile2.Visible = false;
                            }
                        }
                        
                        break;

                    case "ok_3":

                        spesa = Globals.soldiPrima - Globals.soldiDopo;
                        guadagno = Globals.soldiDopoVendita - Globals.soldiPrima + Globals.soldiDopo;
                        val_4 = Val_porta_4();
                        risp = System.Convert.ToDouble(risposta.Text);

                        if(page == 2)
                        {
                            if(risp == val_4)
                            {
                                ok_2.Visible = false;
                                testo.Visible = true; //XXXXXX false;
                                ok_3.Visible = true;
                                testo2.Visible = true;
                                risposta.Visible = true;
                                smile2.Visible = true;
                                nosmile2.Visible = false;
                                smile.Visible = false;
                                nosmile.Visible = false;

                                pagina_ok = true;
                            }

                            else
                            {
                                nosmile2.Visible = true;
                                smile2.Visible = false;
                                smile.Visible = false;
                                nosmile.Visible = false;

                                pagina_ok = false;
                            }
                        }
			else if(page == 3)
                        {
                            if(risp == val_4)
                            {
                                ok_2.Visible = false;
                                testo.Visible = true; //XXXXXX false;
                                ok_3.Visible = true;
                                testo2.Visible = true;
                                risposta.Visible = true;
                                smile2.Visible = true;
                                nosmile2.Visible = false;
                                smile.Visible = false;
                                nosmile.Visible = false;

                                pagina_ok = true;
                            }

                            else
                            {
                                nosmile2.Visible = true;
                                smile2.Visible = false;
                                smile.Visible = false;
                                nosmile.Visible = false;

                                pagina_ok = false;
                            }
                        }

                        break;

                    case "avanti":

                        if(pagina_ok == true)
                        {
                            if(page == 1)
                            {
                          //    nonSo = new NonSo(2);
                                nonSo = new NonSo(2);
                                nonSo.ShowDialog();
                                this.Close();
                            }
                            else if(page == 2)
                            {
                                nonSo = new NonSo(3);
                                nonSo.ShowDialog();
                                this.Close();
                            }
                            else if(page == 3)
                            {
                                this.Close();
                            }
                        }

                        break;
                }
            }
        }
Exemplo n.º 2
0
 private void buttonNonSo_Click(object sender, System.EventArgs e)
 {
     nonSo = new NonSo(1);
     nonSo.ShowDialog();
 }