Пример #1
0
        private void btnCreateCatcher_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Catcher theCatcher = new Catcher(LayoutRoot.Width, ref txtCatcherTop, ref txtCatcherLeft, ref balls);

            theCatcher.MonitoringChanged += new MonitoringHaldler(Catcher_MonitoringChanged);
            theCatcher.Caught            += new CaughtHaldler(Catcher_Caught);
            Canvas.SetLeft(theCatcher, LayoutRoot.Width / 2);
            Canvas.SetTop(theCatcher, (new Random(DateTime.Now.Millisecond).NextDouble()) * (LayoutRoot.Height - theCatcher.Height));
            LayoutRoot.Children.Add(theCatcher);
            catchers.Add(theCatcher.GetHashCode(), theCatcher);
            updateLabels();
        }
Пример #2
0
 private void selectCatcher()
 {
     if (selectedCatcher >= 0 && selectedCatcher < catchers.Count)
     {
         KeyValuePair <int, Catcher> k = catchers.ElementAt(selectedCatcher);
         Catcher p = k.Value;
         p.Monitoring = true;
         updateLabels();
     }
     else
     {
         selectedCatcher = 0;
     }
 }
Пример #3
0
 private void Catcher_MonitoringChanged(object sender, MonitoringArgs e)
 {
     if (e.valor) //Important to avoid recursivity
     {
         if (monitoredCatcher != null)
         {
             if (monitoredCatcher != (Catcher)sender)
             {
                 monitoredCatcher.Monitoring = false;
             }
         }
         monitoredCatcher = (Catcher)sender;
     }
 }
 private void Catcher_MonitoringChanged(object sender, MonitoringArgs e)
 {
     if (e.valor) //Important to avoid recursivity
     {
         if(monitoredCatcher != null)
         {
             if(monitoredCatcher != (Catcher)sender)
                 monitoredCatcher.Monitoring = false;
         }
         monitoredCatcher = (Catcher)sender;
     }
 }
 private void btnCreateCatcher_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     Catcher theCatcher = new Catcher(LayoutRoot.Width, ref txtCatcherTop, ref txtCatcherLeft, ref balls);
     theCatcher.MonitoringChanged += new MonitoringHaldler(Catcher_MonitoringChanged);
     theCatcher.Caught += new CaughtHaldler(Catcher_Caught);
     Canvas.SetLeft(theCatcher, LayoutRoot.Width / 2);
     Canvas.SetTop(theCatcher, (new Random(DateTime.Now.Millisecond).NextDouble()) * (LayoutRoot.Height - theCatcher.Height));
     LayoutRoot.Children.Add(theCatcher);
     catchers.Add(theCatcher.GetHashCode(), theCatcher);
     updateLabels();
 }