private void CharDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (CharDataGrid.SelectedIndex == -1) { Close(); return; } Choice = (CharSaves)CharDataGrid.SelectedItem; Close(); }
public List <CharSaves> LoadCharSet() { List <CharSaves> output = new List <CharSaves>(); var PathX = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "SSTool", "Saves"); if (!Directory.Exists(PathX)) { MessageBox.Show("Could not find SSTool/Saves Directory: " + PathX); return(output); } var files = Directory.GetFiles(PathX, "*.json*"); foreach (var file in files) { CharSaves load = JsonConvert.DeserializeObject <CharSaves>(File.ReadAllText(file)); output.Add(load); } return(output); }