Advertisement
buresm

videostop

Apr 23rd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using System.Windows.Threading;
  16. namespace videostop
  17. {
  18.     /// <summary>
  19.     /// Interaction logic for MainWindow.xaml
  20.     /// </summary>
  21.     public partial class MainWindow : Window
  22.     {
  23.         DispatcherTimer casovac;
  24.         Random rnd;
  25.         int body = 0;
  26.  
  27.         int cis1, cis2, cis3;
  28.  
  29.         public MainWindow()
  30.         {
  31.             InitializeComponent();
  32.             casovac = new DispatcherTimer();
  33.             casovac.Interval = new TimeSpan(0, 0, 0, 0, 500);
  34.             casovac.Tick += Casovac_Tick;
  35.             rnd = new Random();
  36.         }
  37.  
  38.        
  39.         private void Casovac_Tick(object sender, EventArgs e)
  40.         {
  41.             cis1 = rnd.Next(1, 7);
  42.             cis2 = rnd.Next(1, 7);
  43.             cis3 = rnd.Next(1, 7);
  44.             Lb1.Content = cis1;
  45.             Lb2.Content = cis2;
  46.             Lb3.Content = cis3;
  47.         }
  48.  
  49.         private void BtnStart_Click(object sender, RoutedEventArgs e)
  50.         {
  51.             casovac.Start();
  52.         }
  53.  
  54.         private void BtnStop_Click(object sender, RoutedEventArgs e)
  55.         {
  56.             casovac.Stop();
  57.             if(cis1 == cis2 && cis2 == cis3) body= body+10;
  58.             else if (cis1 == cis2 || cis2 == cis3 || cis1 == cis3) body++;
  59.             LbScore.Content = "Score je " + body.ToString();
  60.         }
  61.  
  62.        
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement