界面

代码
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 robot
{
public partial class Form2 : Form
{
robot r1 = new robot();
public Form2()
{
r1.name = "小A";
r1.age = 8;
InitializeComponent();
}
public class robot
{
public string name
{
get;
set;
}
public int age
{
get;
set;
}
public string sayhello()
{
return string .Format ("你好!我叫{0}", name);
}
public string speak(string str)//对话方法
{
if (str.Contains("姓名") || str.Contains("名字") || str.Contains("叫什么"))
{
return string.Format ("嘻嘻,我叫{0}", name);
}
else if (str.Contains("年龄") || str.Contains("多大了") || str.Contains("多大岁数"))
{
return string.Format("今年{0}岁了", age);
}
else if (str.Contains("你好") || str.Contains("hello") || str.Contains("hi"))
{
return string.Format("你也好,哈哈");
}
else if (str.Contains("天气") || str.Contains("心情"))
{
return string.Format("天气好心情自然就好了阿,嘿嘿");
}
else if (str.Contains("笑话") || str.Contains("搞笑的"))
{
return string.Format("从前有个鬼,他放了个屁,然后死掉了,哈哈哈哈");
}
else
{
return string.Format("不好意思,你在说什么我听不懂欸!");
}
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox2 .Text += textBox1.Text + "\n";
textBox1.Text = "";
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
textBox2.Text = "";
textBox2 .Text = r1.sayhello();
string str = textBox1.Text;
while (true)
{
textBox2 .Text = r1.speak(str);
}
}
}
}
求大神指点一下,现在一发送就未响应
小白新手谢过