aleukhin b982972b9f 1st com | преди 6 месеца | |
---|---|---|
.vs | преди 6 месеца | |
WpfApp1 | преди 6 месеца | |
img | преди 6 месеца | |
WpfApp1.sln | преди 6 месеца | |
readme.md | преди 6 месеца |
изменения в Xaml.Cs
public class JSONDataProvider : LocalDataProvider, IDataProvider
{
private List<Worker> _WorkerList;
public JSONDataProvider()
{
var serializer = new DataContractJsonSerializer(typeof(Worker[]));
using (var sr = new StreamReader("./data.json"))
{
_WorkerList = ((Worker[])serializer.ReadObject(sr.BaseStream)).ToList();
}
}
public IEnumerable<Worker> getWorker()
{
return _WorkerList;
}
}
private bool sortAsc = true;
private bool sortAsc = true;
private void RadioButton_Checked(object sender, RoutedEventArgs e) {
sortAsc = (sender as RadioButton).Tag.ToString() == "1";
Invalidate();
}
изменился еще class 4
using System; using System.Collections.Generic; using System.Formats.Asn1; using System.Globalization; using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using CsvHelper; using WpfApp1;
namespace WpfApp1.model {
[DataContract]
public class Worker
{
[DataMember]
public string name { get; set; }
[DataMember]
public string Pos { get; set; }
[DataMember]
public int Age { get; set; }
[DataMember]
public string Sex { 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();
}
}
}
}