void service_GetAlarmItemsCompleted(object sender, GetAlarmItemsCompletedEventArgs e) { this.Busy.IsBusy = false; if (e.Error != null) { e.Error.ShowError(); return; } if (e.Result != null) { if (tabControl1 != null) { if (tabControl1.SelectedIndex == 0) { var count = e.Result.Count; if (count == 0) { OpenGrid.Width = 1050; } else { OpenGrid.Width = double.NaN; } if (firstbind == true) { PagedCollectionView pcv = new PagedCollectionView(Enumerable.Range(0, count)); OpenPager.Source = pcv; OpenPager2.Source = pcv; firstbind = false; } OpenGrid.ItemsSource = e.Result.Data.ToList(); OpenGrid.Tag = e.Result.Data; OpenCount.Text = string.Format("总页数:{0} 总记录数:{1}", OpenPager.PageCount, count); OpenCount2.Text = string.Format("总页数:{0} 总记录数:{1}", OpenPager.PageCount, count); } if (tabControl1.SelectedIndex == 1) { var count = e.Result.Count; if (count == 0) { HandleGrid.Width = 1050; } else { HandleGrid.Width = double.NaN; } if (firstbind == true) { PagedCollectionView pcv = new PagedCollectionView(Enumerable.Range(0, count)); HandlePager.Source = pcv; HandlePager2.Source = pcv; firstbind = false; } HandleGrid.ItemsSource = e.Result.Data.ToList(); HandleGrid.Tag = e.Result.Data; HandleCount.Text = string.Format("总页数:{0} 总记录数:{1}", HandlePager.PageCount, count); HandleCount2.Text = string.Format("总页数:{0} 总记录数:{1}", HandlePager.PageCount, count); } if (tabControl1.SelectedIndex == 2) { var count = e.Result.Count; if (count == 0) { ClosedGrid.Width = 1050; } else { ClosedGrid.Width = double.NaN; } if (firstbind == true) { PagedCollectionView pcv = new PagedCollectionView(Enumerable.Range(0, count)); ClosedPager.Source = pcv; ClosedPager2.Source = pcv; firstbind = false; } ClosedGrid.ItemsSource = e.Result.Data.ToList(); ClosedGrid.Tag = e.Result.Data; ClosedCount.Text = string.Format("总页数:{0} 总记录数:{1}", ClosedPager.PageCount, count); ClosedCount2.Text = string.Format("总页数:{0} 总记录数:{1}", ClosedPager.PageCount, count); } } } }
void service_GetAlarmItemsCompleted(object sender, GetAlarmItemsCompletedEventArgs e) { this.Busy.IsBusy = false; if (e.Error != null) { e.Error.ShowError(); return; } if (e.Result != null) { if (tabControl1 != null) { if (tabControl1.SelectedIndex == 0) { var count = e.Result.Count; if (count == 0) { OpenGrid.Width = 1050; } else { OpenGrid.Width = double.NaN; } if (firstbind == true) { PagedCollectionView pcv = new PagedCollectionView(Enumerable.Range(0, count)); OpenPager.Source = pcv; OpenPager2.Source = pcv; firstbind = false; } OpenGrid.ItemsSource = e.Result.Data.ToList(); OpenGrid.Tag = e.Result.Data; OpenCount.Text = string.Format("总页数:{0} 总记录数:{1}", OpenPager.PageCount, count); OpenCount2.Text = string.Format("总页数:{0} 总记录数:{1}", OpenPager.PageCount, count); } if (tabControl1.SelectedIndex == 1) { var count = e.Result.Count; if (count == 0) { HandleGrid.Width = 1050; } else { HandleGrid.Width = double.NaN; } if (firstbind == true) { PagedCollectionView pcv = new PagedCollectionView(Enumerable.Range(0, count)); HandlePager.Source = pcv; HandlePager2.Source = pcv; firstbind = false; } HandleGrid.ItemsSource = e.Result.Data.ToList(); HandleGrid.Tag = e.Result.Data; HandleCount.Text = string.Format("总页数:{0} 总记录数:{1}", HandlePager.PageCount, count); HandleCount2.Text = string.Format("总页数:{0} 总记录数:{1}", HandlePager.PageCount, count); } if (tabControl1.SelectedIndex == 2) { var count = e.Result.Count; if (count == 0) { ClosedGrid.Width = 1050; } else { ClosedGrid.Width = double.NaN; } if (firstbind == true) { PagedCollectionView pcv = new PagedCollectionView(Enumerable.Range(0, count)); ClosedPager.Source = pcv; ClosedPager2.Source = pcv; firstbind = false; } ClosedGrid.ItemsSource = e.Result.Data.ToList(); ClosedGrid.Tag = e.Result.Data; ClosedCount.Text = string.Format("总页数:{0} 总记录数:{1}", ClosedPager.PageCount, count); ClosedCount2.Text = string.Format("总页数:{0} 总记录数:{1}", ClosedPager.PageCount, count); } } } }