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(); }