public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/BrokeThePig;component/MainPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.AdControl = ((Microsoft.Advertising.Mobile.UI.AdControl)(this.FindName("AdControl"))); this.ContentLayout = ((System.Windows.Controls.Canvas)(this.FindName("ContentLayout"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle"))); this.Counter = ((System.Windows.Controls.TextBlock)(this.FindName("Counter"))); this.AmountOfMoney = ((System.Windows.Controls.TextBlock)(this.FindName("AmountOfMoney"))); this.PigLayout = ((System.Windows.Controls.Canvas)(this.FindName("PigLayout"))); this.Pig = ((BrokeThePig.UC.Pig)(this.FindName("Pig"))); }
void b_Tap(object sender, GestureEventArgs e) { PigLayout.Tap -= b_Tap; Pig.Exploded -= Pig_Exploded; double left = Canvas.GetLeft(Pig); double top = Canvas.GetTop(Pig); PigLayout.Children.Clear(); Pig = new Pig(); Canvas.SetLeft(Pig, left); Canvas.SetTop(Pig, top); Pig.Exploded += Pig_Exploded; PigLayout.Children.Add(Pig); }