Exemplo n.º 1
0
 public Controller(DataGridView dataGridView, Model _model)
 {
     model = _model;
     dataGridView.CellMouseClick += (object sender, DataGridViewCellMouseEventArgs e) =>
     {
         model.addWave(e.ColumnIndex, e.RowIndex);
     };
 }
        public ControlModel(Model model, Button btn, RichTextBox tBox1, RichTextBox tBox2, RichTextBox tBoxOutput)
        {
            this.model = model;
            this.buttonStartTest = btn;
            this.tBox1 = tBox1;
            this.tBox2 = tBox2;
            this.tBoxOutput = tBoxOutput;

            this.tBox1.TextChanged += (object sender, EventArgs e) =>
            {
               this.buttonStartTest.Enabled = (this.model.isCorrectData(this.tBox1.Text, this.tBox2.Text) ? true : false);
            };

            this.tBox2.TextChanged += (object sender, EventArgs e) =>
            {
                this.buttonStartTest.Enabled = (this.model.isCorrectData(this.tBox1.Text, this.tBox2.Text) ? true : false);
            };

            //this.buttonStartTest.Enabled = false;
            this.buttonStartTest.Click += (object sender, EventArgs e) =>
            {
                this.model.startGame(this.tBox1.Text, this.tBox2.Text);
            };
        }