public InformationAboutCatalogItem(IDescription catalogItem, Uri path) : this() { ElementRenderer.VisualizeImageInPanel(this.PictureBoxContainer, catalogItem.Name, path); this.NameText.Text = catalogItem.Name; this.GenreText.Text = string.Join(", ", catalogItem.Genres); this.YearText.Text = catalogItem.ReleaseYear; bool isInStock = (catalogItem as IStockable).IsInStock; this.IsInStockText.Text = isInStock ? "Available" : "Not Available"; this.IsInStockText.Foreground = isInStock ? Brushes.Green : Brushes.Red; Button stockButton = null; if (catalogItem is ISaleable) { this.PriceImage.Visibility = Visibility.Visible; this.SellPriceTextBlock.Text = string.Format("{0:C}", (catalogItem as ISaleable).Price); this.SellButton.Visibility = Visibility.Visible; stockButton = this.SellButton; // Set Click event to Sell Button this.SellButton.Click += (sender, args) => { Basket.PurchasedItems.Add(catalogItem as ISaleable); }; } else if (catalogItem is IRentable) { this.PricePerDayImage.Visibility = Visibility.Visible; this.RentalPricePerDayTextBlock.Text = string.Format("{0:C}", (catalogItem as IRentable).PricePerDay); this.RentButton.Visibility = Visibility.Visible; stockButton = this.RentButton; // Set Click event to Rent Button this.RentButton.Click += (sender, args) => { RentOptionScreen rentScreen = new RentOptionScreen(catalogItem as IRentable); rentScreen.OldContent = this.Content; this.Content = rentScreen.Content; this.DataContext = rentScreen.DataContext; }; } if (stockButton != null && !isInStock) { stockButton.IsEnabled = false; } this.CloseButton.Focus(); }