Example #1
0
        private void PopulateCardImages()
        {
            string imagesDirectory = "Images";

            CardImages.Clear();
            for (int i = 1; i <= DifferentCardsCount; i++)
            {
                string fileName = Path.GetFullPath(Path.Combine(imagesDirectory, +i + ".jpg"));
                if (!File.Exists(fileName))
                {
                    MessageBox.Show(this, "Cannot open file " + fileName, "Error", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    Close();
                }


                CardImages.Add(new CardImage()
                {
                    FilePath = fileName, Name = "name" + i, Date = File.GetCreationTime(fileName)
                });
            }
        }