public CardCanvas(Card card, Image cardImage, double width, double height, Thickness margin, bool isUpgrade, DefaultPage currentPage = null) { string baseLocation = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; filteredLocation = System.IO.Path.GetDirectoryName(baseLocation).Replace("file:\\", "") + "\\Misc\\"; this.margin = margin; this.cardImage = cardImage; this.currentPage = currentPage; this.height = height; this.width = width; this.isUpgrade = isUpgrade; DropShadowEffect dropShadow = new DropShadowEffect(); dropShadow.BlurRadius = Opt.ApResMod(2); dropShadow.ShadowDepth = Opt.ApResMod(1); Effect = dropShadow; if (this.isUpgrade) { upgrade = (Upgrade)card; } else { pilot = (Pilot)card; } ConstructCanvas(); }
public CardCanvas GetCanvas(double width, double height, Thickness margin, DefaultPage currentPage = null) { if (resizedCardImage == null) { resizedCardImage = new BitmapImage(); resizedCardImage.BeginInit(); resizedCardImage.CacheOption = BitmapCacheOption.OnLoad; resizedCardImage.StreamSource = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read); resizedCardImage.EndInit(); resizedCardImage.Freeze(); hasCardImage = true; } System.Windows.Controls.Image cardImage = new System.Windows.Controls.Image(); cardImage.Source = resizedCardImage; CardCanvas cardCanvas = new CardCanvas(this, cardImage, width, height, margin, isUpgrade, currentPage); cardCanvasList.Add(cardCanvas); return(cardCanvas); }