private Image CreateImage(Classes.Upgrade upgrade, int GridRow, int GridColumn) { Image IMGItemImage = new Image(); IMGItemImage.HorizontalAlignment = HorizontalAlignment.Stretch; IMGItemImage.VerticalAlignment = VerticalAlignment.Stretch; IMGItemImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/Square44x44Logo.scale-200.png"));//needs replacement IMGItemImage.Stretch = Stretch.Fill; Grid.SetRow(IMGItemImage, GridRow); Grid.SetColumn(IMGItemImage, GridColumn); return(IMGItemImage); }
private TextBlock CreateTextBlock(Classes.Upgrade upgrade, int GridRow, int GridColumn) { TextBlock TBItemInfo = new TextBlock(); TBItemInfo.TextWrapping = TextWrapping.WrapWholeWords; TBItemInfo.HorizontalAlignment = HorizontalAlignment.Stretch; TBItemInfo.VerticalAlignment = VerticalAlignment.Stretch; TBItemInfo.Text = "Name: " + upgrade.Name + "\nCost: " + upgrade.Cost + "\nPower: " + upgrade.Power + "\nCount: " + upgrade.Count; TBItemInfo.FontSize = 13; Grid.SetRow(TBItemInfo, GridRow); Grid.SetColumn(TBItemInfo, GridColumn); return(TBItemInfo); }
private void BTItemButton_Click(object sender, RoutedEventArgs e, Classes.Upgrade Upgrade) { Button temp = sender as Button; if (User.Gold >= Upgrade.Cost) { User.Gold -= Upgrade.Cost; User.GoldPerClick += Upgrade.Power; Upgrade.Count += 1; Upgrade.Cost = Convert.ToSingle(Math.Round(Upgrade.Cost * 1.15f)); temp.Tag = Upgrade.Cost; LoadUpgrades(null, null); } }
private Button CreateButton(Classes.Upgrade upgrade, int GridRow, int GridColumn) { Button BTItemButton = new Button(); BTItemButton.Content = "Click!"; BTItemButton.HorizontalAlignment = HorizontalAlignment.Stretch; BTItemButton.VerticalAlignment = VerticalAlignment.Stretch; BTItemButton.Background = new SolidColorBrush(Colors.SkyBlue); BTItemButton.Click += (sender, e) => BTItemButton_Click(sender, e, upgrade); BTItemButton.Tag = upgrade.Cost; Grid.SetRow(BTItemButton, GridRow); Grid.SetColumn(BTItemButton, GridColumn); return(BTItemButton); }