private void ClickButtonImportCardJSONMethod() { OpenFileDialog openfileDialog = new OpenFileDialog(); if (openfileDialog.ShowDialog() == true) { string filePath = openfileDialog.FileName; if (FileValidator.ValidateCardFileType(filePath)) { string cardToImport; cardToImport = File.ReadAllText(filePath); Card resultCard = JsonConvert.DeserializeObject <Card>(cardToImport); // test CurrentCardId = resultCard.Id; NameText = resultCard.Name; SelectedTypeIdText = TypeList[resultCard.TypeId - 1]; // hack for å få index som begynner på null til å funke med id som starte på 1 ImageSourceText = resultCard.ImageURL; ManaCostText = resultCard.ManaCost; AttackText = resultCard.AttackPower; HpText = resultCard.Hp; PowerLevelText = resultCard.PowerLevel; RaisePropertyChanged(""); } else { MessageBox.Show("Invalid file type, only json and JSON"); } } }