Example #1
0
        private void response_Load(object sender, EventArgs e)
        {
            string[] lines  = File.ReadAllLines(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer.txt");
            string[] lines1 = File.ReadAllLines(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer1.txt");
            int      score  = 0;

            for (int i = 0; i < lines.Length; i++)
            {
                string line  = lines[i];
                string line1 = lines1[i];
                if (line.Equals(line1))
                {
                    score++;
                }
            }

            richTextBox1.Text = File.ReadAllText(@"C: \Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer.txt");
            richTextBox2.Text = File.ReadAllText(@"C: \Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer1.txt");
            richTextBox3.AppendText(score.ToString());

            if (score == 0)
            {
                MessageBox.Show("Your score is 0, try again.");
                var khelshuru = new khelshuru();
                khelshuru.Show();
                this.Close();
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var khelshuru = new khelshuru();

            khelshuru.Show();
            this.Hide();
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string[] lines = File.ReadAllLines(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\user.txt");

            for (int i = 0; i < lines.Length; i++)
            {
                line = lines[i];
                if (line.Equals(login_name))
                {
                    i = lines.Length;

                    if (flag == 1)
                    {
                        flag = 0; f = 1;
                        MessageBox.Show("Authenticated for player 1, now login/signup for player 2.");
                        var home = new home();
                        home.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Authenticated for both players, now let the games begin");
                        var khelshuru = new khelshuru();
                        f = 0;
                        khelshuru.Show();
                        this.Hide();
                    }
                }
            }
            if (f == 1 && flag != 0)
            {
                MessageBox.Show("Not Authenticated,try again");
                var login = new login();
                login.Show();
                this.Hide();
            }
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int option = -1;

            if (radioButton1.Checked == true)
            {
                option = 1;
            }
            else if (radioButton2.Checked == true)
            {
                option = 2;
            }
            else if (radioButton3.Checked == true)
            {
                option = 3;
            }
            else if (radioButton4.Checked == true)
            {
                option = 4;
            }
            else if (radioButton5.Checked == true)
            {
                option = 5;
            }
            else if (radioButton6.Checked == true)
            {
                option = 6;
            }

            if (option == -1)
            {
                MessageBox.Show("Select an input");
            }
            else
            {
                if (f == 1)
                {
                    answer[count] = option;

                    if (count == 4)
                    {
                        Console.Write("\nanswers:\n");
                        File.WriteAllText(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer.txt", String.Empty);
                        foreach (int ans in answer)
                        {
                            string mystring     = ans.ToString();
                            string endcharacter = "\n";
                            File.AppendAllText(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer.txt", mystring);
                            File.AppendAllText(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer.txt", endcharacter);
                        }

                        MessageBox.Show("Player2 Turn.");
                        f = 0; count = 0;
                        khelshuru Check = new khelshuru();
                        Check.Show();
                        this.Hide();
                    }
                    else
                    {
                        count += 1;
                        khelshuru Check = new khelshuru();
                        Check.Show();
                        this.Hide();
                    }
                }

                else
                {
                    answer[count] = option;

                    if (count == 4)
                    {
                        Console.Write("\nanswers:\n");
                        File.WriteAllText(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer1.txt", String.Empty);
                        foreach (int ans in answer)
                        {
                            string mystring     = ans.ToString();
                            string endcharacter = "\n";
                            File.AppendAllText(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer1.txt", mystring);
                            File.AppendAllText(@"C:\Users\MAHE\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\answer1.txt", endcharacter);
                        }
                        f = 1; count = 0;
                        response Check = new response();
                        Check.Show();
                        this.Hide();
                    }
                    else
                    {
                        count += 1;
                        khelshuru Check = new khelshuru();
                        Check.Show();
                        this.Hide();
                    }
                }
            }
        }