public void LoadItems(Items items, Computers computers) { List <ListBoxObject> items_source = new List <ListBoxObject>(); ViewItems viewItems = new ViewItems(); items_source = viewItems.GetSaveItemsSource(items, items_source, computers.PlayerComputers); foreach (OpticalDisc opticalDisc in GameEnvironment.Items.OpticalDiscs) { string path = "Resources/discs/" + opticalDisc.Properties.CoverName + ".png"; Uri uri = new Uri("pack://application:,,,/" + path); if (System.IO.File.Exists(System.IO.Path.GetFullPath(path)) == false) { uri = new Uri("pack://application:,,,/Resources/discs/disc-cover_empty.png"); } BitmapImage image = new BitmapImage(uri); GameGraphics gameGraphics = new GameGraphics(); BitmapImage icon = gameGraphics.GlueImages(image, new BitmapImage(new Uri("pack://application:,,,/Resources/discs/disc-case.png"))); items_source.Add(new ListBoxObject(opticalDisc, icon, Visibility.Hidden)); } int currenSize = 0; foreach (ListBoxObject obj in items_source) { if (obj.LabelVisibility == Visibility.Visible) { currenSize++; } } Title.Text = "Кладовка (" + (items_source.Count - currenSize) + " из " + MaxSize + ")"; InventoryList.ItemsSource = items_source; }