-
Notifications
You must be signed in to change notification settings - Fork 0
/
Level1.xaml.cs
159 lines (141 loc) · 4.79 KB
/
Level1.xaml.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Threading;
using System.Windows.Media;
namespace FindingTag
{
public partial class LandScape : PhoneApplicationPage
{
int count, timeCount;
DispatcherTimer dispatcherTimer;
public LandScape()
{
InitializeComponent();
Logic.Score = 0;
count = 0;
}
Random R = new Random();
void countDown()
{
timeCount = 60;
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1000);
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
}
void dispatcherTimer_Tick(object sender, EventArgs e)
{
if (count == 0)
{
dispatcherTimer.Stop();
NavigationService.Navigate(new Uri("/Result.xaml",UriKind.Relative));
}
Time.Text = "Remaining Time : " + timeCount;
timeCount--;
}
void location()
{
int X1 = R.Next(3, 320);
int Y1 = R.Next(3, 470);
int X2 = R.Next(3, 320);
int Y2 = R.Next(3, 470);
int X3 = R.Next(3, 320);
int Y3 = R.Next(3, 470);
int X4 = R.Next(3, 320);
int Y4 = R.Next(3, 470);
int X5 = R.Next(3, 320);
int Y5 = R.Next(3, 470);
int X6 = R.Next(3, 320);
int Y6 = R.Next(3, 470);
int X7 = R.Next(3, 320);
int Y7 = R.Next(3, 470);
int X8 = R.Next(3, 320);
int Y8 = R.Next(3, 470);
I1.Margin = new Thickness(X1, Y1, 0, 0);
I2.Margin = new Thickness(X2, Y2,0, 0);
I3.Margin = new Thickness(X3, Y3, 0, 0);
I4.Margin = new Thickness(X4, Y4, 0, 0);
I5.Margin = new Thickness(X5, Y5, 0, 0);
I6.Margin = new Thickness(X6, Y6, 0, 0);
I7.Margin = new Thickness(X7, Y7, 0, 0);
I8.Margin = new Thickness(X8, Y8, 0, 0);
}
private void I1_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I1.Visibility = Visibility.Collapsed;
_01.Visibility = Visibility.Collapsed;
soundStart("Button.mp3");
countI();
}
private void I2_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I2.Visibility = Visibility.Collapsed;
_02.Visibility = Visibility.Collapsed;
countI();
soundStart("Button.mp3");
}
private void I3_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I3.Visibility = Visibility.Collapsed;
_03.Visibility = Visibility.Collapsed;
countI();
soundStart("Button.mp3");
}
private void I4_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I4.Visibility = Visibility.Collapsed;
_04.Visibility = Visibility.Collapsed;
soundStart("Button.mp3");
countI();
}
private void I5_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I5.Visibility = Visibility.Collapsed;
_05.Visibility = Visibility.Collapsed;
countI();
soundStart("Button.mp3");
}
private void I6_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I6.Visibility = Visibility.Collapsed;
_06.Visibility = Visibility.Collapsed;
countI();
soundStart("Button.mp3");
}
private void I7_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I7.Visibility = Visibility.Collapsed;
_07.Visibility = Visibility.Collapsed;
countI();
soundStart("Button.mp3");
}
private void I8_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
I8.Visibility = Visibility.Collapsed;
_08.Visibility = Visibility.Collapsed;
countI();
soundStart("Button.mp3");
}
void countI()
{
count++;
Logic.Score += 10;
if (count == 8)
{
NavigationService.Navigate(new Uri("/Result.xaml", UriKind.Relative));
}
}
void soundStart(string name)
{
mediaElement1.Source= new Uri("Audio/"+name,UriKind.Relative);
mediaElement1.Volume = 0.8;
mediaElement1.Play();
}
}
}