aleukhin b982972b9f 1st com | 6 ay önce | |
---|---|---|
.vs | 6 ay önce | |
WpfApp1 | 6 ay önce | |
img | 6 ay önce | |
WpfApp1.sln | 6 ay önce | |
readme.md | 6 ay önce |
изменения в 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();
}
}
}
}