-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomeActivity.cs
76 lines (68 loc) · 2.31 KB
/
HomeActivity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace HangingMan
{
[Activity(Label = "HomeActivity",MainLauncher =true)]
public class HomeActivity : Activity
{
Button s1, s2, s3, s4,add;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.HomeScr);
Words.InitDb();
s1 = FindViewById<Button>(Resource.Id.sub1);
s2 = FindViewById<Button>(Resource.Id.sub2);
s3 = FindViewById<Button>(Resource.Id.sub3);
s4 = FindViewById<Button>(Resource.Id.sub4);
add = FindViewById<Button>(Resource.Id.add);
s1.Click += OnClick;
s2.Click += OnClick;
s3.Click += OnClick;
s4.Click += OnClick;
add.Click += OnClick;
// Create your application here
}
private void OnClick(object sender, EventArgs e)
{
Button btn = (Button)sender;
if (btn == s1)
{
Intent intent = new Intent(this, typeof(GameActivity));
intent.PutExtra("category", s1.Text);
StartActivity(intent);
}
else if (btn == s2)
{
Intent intent = new Intent(this, typeof(GameActivity));
intent.PutExtra("category", s2.Text);
StartActivity(intent);
}
else if (btn == s3)
{
Intent intent = new Intent(this, typeof(GameActivity));
intent.PutExtra("category", s3.Text);
StartActivity(intent);
}
else if (btn == s4)
{
Intent intent = new Intent(this, typeof(GameActivity));
intent.PutExtra("category", s4.Text);
StartActivity(intent);
}
else if (btn == add)
{
Intent intent = new Intent(this, typeof(AddActivity));
StartActivity(intent);
}
}
}
}