检查Checkbox时发送到另一个页面C#Xamarin Android?

时间:2014-05-28 03:04:14

标签: c# android checkbox xamarin

我正在编写一个应用程序,允许用户以复选框的形式选择一个短语。当用户选择获取结果时,复选框需要转到另一个页面。首先,我从所选复选框中选择了文本,然后转到编辑文本,这是在下面的代码中写的,但我需要它作为复选框转到另一页。我该怎么做?这是我发送编辑文本复选框的代码。我需要做些什么改变来实现上述目标?

    public class numbersActivity : Activity
{
    protected override void OnCreate (Bundle bundle)
    { 
        base.OnCreate (bundle);
        //Variables
        SetContentView (Resource.Layout.numbers);
        CheckBox cb0 = FindViewById<CheckBox> (Resource.Id.checkBox0);
        CheckBox cb1 = FindViewById<CheckBox> (Resource.Id.checkBox1);
        CheckBox cb2 = FindViewById<CheckBox> (Resource.Id.checkBox2);
        CheckBox cb3 = FindViewById<CheckBox> (Resource.Id.checkBox3);
        Button button0 = FindViewById<Button> (Resource.Id.button0);
        //Back Button
        button0.Click += delegate {
            StartActivity(typeof(MainActivity));
            };
        //Get Results button
        Button button01 = FindViewById<Button> (Resource.Id.button01);
            button01.Click += delegate {
            if (cb0.Checked) {
                myResources.result100 += cb0 + System.Environment.NewLine;
                    };
            if (cb1.Checked) {
                myResources.result100 += cb1.Text + System.Environment.NewLine;

                    };
            if (cb2.Checked) {
                myResources.result100 += cb2.Text + System.Environment.NewLine;
                    };
            if (cb3.Checked) {
                myResources.result100 += cb3.Text + System.Environment.NewLine;
                    };
            StartActivity (typeof(results));
        };
    }
}

}

0 个答案:

没有答案