## Классы(Добавил чуть чуть кода в класс 4) ``` namespace WpfApp2.model { [DataContract] public class Spares { [DataMember] public string name { get; set; } [DataMember] public string detail { get; set; } [DataMember] public int price { get; set; } [DataMember] public string type { get; set; } [DataMember] public string photo { get; set; } [DataMember] public bool available { get; set; } [DataMember(Name = "date")] private string? stringdate { get; set; } [IgnoreDataMember] public DateTime? date { get { return stringdate == null ? null : DateTime.Parse(stringdate); } set { stringdate = value.ToString(); } } public Uri? ImageBitmap { get { var imageName = Environment.CurrentDirectory + "/img/" + (photo ?? ""); return System.IO.File.Exists(imageName) ? new Uri(imageName) : null; } } } } } ``` ## Mainwindow.xaml(Изменения с прошлой работы) Добавил ListBox вместо DataGrid ``` ``` ## Mainwindow.xaml.cs ``` InitializeComponent(); DataContext = this; Globals.dataProvider = new JSONDataProvider(); SparesList = Globals.dataProvider.getSpares(); SparesDetailList = Globals.dataProvider.getDetail().ToList(); SparesDetailList.Insert(0, new SparesDetail { title = "Деталь" }); SparesPriceList = Globals.dataProvider.getPrice().ToList(); SparesTypeList = Globals.dataProvider.getType().ToList(); SparesTypeList.Insert(0, new SparesType { title = "Тип ТС" }); ``` ``` public class JSONDataProvider : LocalDataProvider, IDataProvider { private List _SparesList; public JSONDataProvider() { var serializer = new DataContractJsonSerializer(typeof(Spares[])); using (var sr = new StreamReader("./data.json")) { _SparesList = ((Spares[])serializer.ReadObject(sr.BaseStream)).ToList(); } } public IEnumerable getSpares() { return _SparesList; } } private bool sortAsc = true; ``` # Скрины работы ![](./img/1.jpg)