Formun Tamamı için Tıklayınız.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication47
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int a = 0;
int c = 1;
int b = 0;
int d = 0;
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
if (radioButton1.Checked)
{
Random rd = new Random();
int sayi = rd.Next(1, 10);
int sayi1 = rd.Next(1, 10);
int sayi2 = rd.Next(1, 10);
int sayi3 = rd.Next(1, 10);
int sayi4 = rd.Next(1, 10);
int sayi5 = rd.Next(1, 10);
int sayi6 = rd.Next(1, 10);
int sayi7 = rd.Next(1, 10);
int sayi8 = rd.Next(1, 10);
int sayi9 = rd.Next(1, 10);
int sayi14 = rd.Next(1, 10);
int sayi10 = rd.Next(1, 10);
int sayi11 = rd.Next(1, 10);
int sayi12 = rd.Next(1, 10);
int sayi13 = rd.Next(1, 10);
int sayi15 = rd.Next(1, 10);
int sayi16 = rd.Next(1, 10);
int topla = rd.Next(50, 100);
button2.Text = sayi.ToString();
button3.Text = sayi1.ToString();
button4.Text = sayi2.ToString();
button5.Text = sayi3.ToString();
button6.Text = sayi4.ToString();
button7.Text = sayi5.ToString();
button8.Text = sayi6.ToString();
button9.Text = sayi7.ToString();
button10.Text = sayi8.ToString();
button11.Text = sayi9.ToString();
button12.Text = sayi10.ToString();
button13.Text = sayi13.ToString();
button14.Text = sayi14.ToString();
button15.Text = sayi15.ToString();
textBox1.Text = topla.ToString();
}
if (radioButton2.Checked)
{
Random rd = new Random();
int sayi = rd.Next(1, 10);
int sayi1 = rd.Next(1, 10);
int sayi2 = rd.Next(1, 10);
int sayi3 = rd.Next(1, 10);
int sayi4 = rd.Next(1, 10);
int sayi5 = rd.Next(1, 10);
int sayi6 = rd.Next(1, 10);
int sayi7 = rd.Next(1, 10);
int sayi8 = rd.Next(1, 10);
int sayi9 = rd.Next(1, 10);
int sayi14 = rd.Next(1, 10);
int sayi10 = rd.Next(1, 10);
int sayi11 = rd.Next(1, 10);
int sayi12 = rd.Next(1, 10);
int sayi13 = rd.Next(1, 10);
int sayi15 = rd.Next(1, 10);
int sayi16 = rd.Next(1, 10);
int carp = rd.Next(100, 500);
button2.Text = sayi.ToString();
button3.Text = sayi1.ToString();
button4.Text = sayi2.ToString();
button5.Text = sayi3.ToString();
button6.Text = sayi4.ToString();
button7.Text = sayi5.ToString();
button8.Text = sayi6.ToString();
button9.Text = sayi7.ToString();
button10.Text = sayi8.ToString();
button11.Text = sayi9.ToString();
button12.Text = sayi10.ToString();
button13.Text = sayi13.ToString();
button14.Text = sayi14.ToString();
button15.Text = sayi15.ToString();
textBox1.Text = carp.ToString();
}
button2.Enabled = true;
button3.Enabled = true;
button4.Enabled = true;
button5.Enabled = true;
button6.Enabled = true;
button7.Enabled = true;
button8.Enabled = true;
button9.Enabled = true;
button10.Enabled = true;
button11.Enabled = true;
button12.Enabled = true;
button13.Enabled = true;
button14.Enabled = true;
button15.Enabled = true;
a = 0;
textBox2.Text = "0";
d = 0;
label3.Visible = true;
}
public void metod()
{
if (b == a)
{
MessageBox.Show("Bravo");
}
}
private void button2_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button2.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button2.Text);
textBox2.Text = c.ToString();
metod();
}
button2.Enabled = false;
}
private void button3_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button3.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button3.Text);
textBox2.Text = c.ToString();
metod();
}
button3.Enabled = false;
}
private void button4_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button4.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button4.Text);
textBox2.Text = c.ToString();
metod();
}
button4.Enabled = false;
}
private void button5_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button5.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button5.Text);
textBox2.Text = c.ToString();
metod();
}
button5.Enabled = false;
}
private void button6_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button6.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c= c * Convert.ToInt32(button6.Text);
textBox2.Text = c.ToString();
metod();
}
button6.Enabled = false;
}
private void button7_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button7.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button7.Text);
textBox2.Text = c.ToString();
metod();
}
button7.Enabled = false;
}
private void button8_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button8.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button8.Text);
textBox2.Text = c.ToString();
metod();
}
button8.Enabled = false;
}
private void button9_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button9.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button9.Text);
textBox2.Text = c.ToString();
metod();
}
button9.Enabled = false;
}
private void button10_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button10.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button10.Text);
textBox2.Text = c.ToString();
metod();
}
button10.Enabled = false;
}
private void button11_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button11.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button11.Text);
textBox2.Text = c.ToString();
metod();
}
button11.Enabled = false;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
b = Convert.ToInt32(textBox1.Text);
}
private void button12_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button12.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button12.Text);
textBox2.Text = c.ToString();
metod();
}
button12.Enabled = false;
}
private void button13_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button13.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button13.Text);
textBox2.Text = c.ToString();
metod();
}
button13.Enabled = false;
}
private void button14_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button14.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button14.Text);
textBox2.Text = c.ToString();
metod();
}
button14.Enabled = false;
}
private void button15_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
a = a + Convert.ToInt32(button15.Text);
textBox2.Text = a.ToString();
metod();
}
if (radioButton2.Checked)
{
c = c * Convert.ToInt32(button15.Text);
textBox2.Text = c.ToString();
metod();
}
button15.Enabled = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
d = d + 1;
label3.Text = d.ToString();
if (d == 15)
{
timer1.Stop();
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
button5.Enabled = false;
button6.Enabled = false;
button7.Enabled = false;
button8.Enabled = false;
button9.Enabled = false;
button10.Enabled = false;
button11.Enabled = false;
button12.Enabled = false;
button13.Enabled = false;
button14.Enabled = false;
button15.Enabled = false;
MessageBox.Show("Süreniz Bitti Yeniden Başlayın");
}
if (b == a)
{
timer1.Stop();
}
}
private void Form1_Load(object sender, EventArgs e)
{
label3.Visible = false;
}
}
}
Hiç yorum yok:
Yorum Gönder