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