Ejemplo n.º 1
0
        private void PreviewGameData(IGame game)
        {
            var listConverter = new ListToStringConverter();
            var dateConverter = new NullableDateToStringConverter();

            TextName.Text = string.IsNullOrEmpty(game.Name) ? TextName.Text : game.Name;

            if (game.Developers != null && game.Developers.Count != 0)
            {
                TextDeveloper.Text = (string)listConverter.Convert(game.Developers, typeof(string), null, null);
            }

            if (game.Publishers != null && game.Publishers.Count != 0)
            {
                TextPublisher.Text = (string)listConverter.Convert(game.Publishers, typeof(string), null, null);
            }

            if (game.Genres != null && game.Genres.Count != 0)
            {
                TextGenres.Text = (string)listConverter.Convert(game.Genres, typeof(string), null, null);
            }

            TextReleaseDate.Text = (string)dateConverter.Convert(game.ReleaseDate, typeof(DateTime?), null, null);
            TextDescription.Text = string.IsNullOrEmpty(game.Description) ? TextName.Text : game.Description;

            if (game.Links != null)
            {
                TempLinks            = game.Links;
                CheckLinks.IsChecked = true;
            }

            if (!string.IsNullOrEmpty(game.Image))
            {
                var extension = Path.GetExtension(game.Image);
                var tempPath  = Path.Combine(Paths.TempPath, "tempimage" + extension);
                if (File.Exists(tempPath))
                {
                    File.Delete(tempPath);
                }

                Web.DownloadFile(game.Image, tempPath);
                ImageImage.Source = BitmapExtensions.BitmapFromFile(tempPath);
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(ImageImage.Tag.ToString()));
            }
        }
Ejemplo n.º 2
0
        private void ButtonPickCat_Click(object sender, RoutedEventArgs e)
        {
            var converter = new ListToStringConverter();
            var dummyGame = new Game()
            {
                Categories = (ComparableList <string>)converter.ConvertBack(TextCategories.Text, typeof(ComparableList <string>), null, CultureInfo.InvariantCulture)
            };

            var window = new CategoryConfigWindow()
            {
                AutoUpdateGame = false,
                Game           = dummyGame,
                Owner          = this
            };

            window.ShowDialog();

            if (window.DialogResult == true)
            {
                TextCategories.Text = (string)converter.Convert(dummyGame.Categories, typeof(string), null, CultureInfo.InvariantCulture);
            }
        }