Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- namespace videostop
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- DispatcherTimer casovac;
- Random rnd;
- int body = 0;
- int cis1, cis2, cis3;
- public MainWindow()
- {
- InitializeComponent();
- casovac = new DispatcherTimer();
- casovac.Interval = new TimeSpan(0, 0, 0, 0, 500);
- casovac.Tick += Casovac_Tick;
- rnd = new Random();
- }
- private void Casovac_Tick(object sender, EventArgs e)
- {
- cis1 = rnd.Next(1, 7);
- cis2 = rnd.Next(1, 7);
- cis3 = rnd.Next(1, 7);
- Lb1.Content = cis1;
- Lb2.Content = cis2;
- Lb3.Content = cis3;
- }
- private void BtnStart_Click(object sender, RoutedEventArgs e)
- {
- casovac.Start();
- }
- private void BtnStop_Click(object sender, RoutedEventArgs e)
- {
- casovac.Stop();
- if(cis1 == cis2 && cis2 == cis3) body= body+10;
- else if (cis1 == cis2 || cis2 == cis3 || cis1 == cis3) body++;
- LbScore.Content = "Score je " + body.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement