//Производит сортировку private void Sort() { if (SortText != "") { Fonbet = new ObservableCollection <SiteRow>(FonbetData.Where(x => x.Sport.Contains(SortText)).OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Olimp = new ObservableCollection <SiteRow>(OlimpData.Where(x => x.Sport.Contains(SortText)).OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Marafon = new ObservableCollection <SiteRow>(MarafonData.Where(x => x.Sport.Contains(SortText)).OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Zenit = new ObservableCollection <SiteRow>(ZenitData.Where(x => x.Sport.Contains(SortText)).OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); PariMatch = new ObservableCollection <SiteRow>(PariMatchData.Where(x => x.Sport.Contains(SortText)).OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); } else { Fonbet = new ObservableCollection <SiteRow>(FonbetData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Olimp = new ObservableCollection <SiteRow>(OlimpData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Marafon = new ObservableCollection <SiteRow>(MarafonData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Zenit = new ObservableCollection <SiteRow>(ZenitData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); PariMatch = new ObservableCollection <SiteRow>(PariMatchData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); } }
private void LoadData() { try { FonbetData = SiteRow.Load("Fonbet.data"); OlimpData = SiteRow.Load("Olimp.data"); MarafonData = SiteRow.Load("Marafon.data"); ZenitData = SiteRow.Load("Zenit.data"); PariMatchData = SiteRow.Load("PariMatch.data"); Base = new ObservableCollection <UnicData>(UnicData.Load("bd.data").OrderBy(x => x.Id)); } catch { Base = new ObservableCollection <UnicData>(); } Base.CollectionChanged += Base_CollectionChanged; if (Base.Count != 0) { foreach (UnicData key in Base) { foreach (SiteRow t in FonbetData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in OlimpData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in MarafonData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in ZenitData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in PariMatchData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } } } Fonbet = new ObservableCollection <SiteRow>(FonbetData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Olimp = new ObservableCollection <SiteRow>(OlimpData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Marafon = new ObservableCollection <SiteRow>(MarafonData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Zenit = new ObservableCollection <SiteRow>(ZenitData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); PariMatch = new ObservableCollection <SiteRow>(PariMatchData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); }