// 分页功能----------------------------------------------- private void NextImage_Tapped(object sender, TappedRoutedEventArgs e) { if (EscalationThreadList.Count == 0) { this.PageTxt.Text = "0"; MyScrollView.Height = 100; DataGrid.ItemsSource = null; } else { int AllPageIndex = FTEEscalationThreadViewModel.GetPageIndex(EscalationThreadList, pageSize); int index = Convert.ToInt32(PageTxt.Text.ToString()); index++; if (index < AllPageIndex) { var EscalationThreadListPage = EscalationThreadList.Skip((index - 1) * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage; setScrollViewheight(EscalationThreadListPage); PageTxt.Text = index.ToString(); } else { var EscalationThreadListPage = EscalationThreadList.Skip((AllPageIndex - 1) * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage; setScrollViewheight(EscalationThreadListPage); int count = EscalationThreadList.Count; PageTxt.Text = AllPageIndex.ToString(); } } }
private void PreviousImage_Tapped(object sender, TappedRoutedEventArgs e) { if (EscalationThreadList.Count == 0) { this.PageTxt.Text = "0"; MyScrollView.Height = 100; DataGrid.ItemsSource = null; } else { if (Convert.ToInt32(PageTxt.Text.ToString()) == 1) { var EscalationThreadListPage1 = EscalationThreadList.Skip(0 * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage1; setScrollViewheight(EscalationThreadListPage1); PageTxt.Text = "1"; } else { var EscalationThreadListPage = EscalationThreadList.Skip((Convert.ToInt32(PageTxt.Text.ToString())) - 1 * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage; setScrollViewheight(EscalationThreadListPage); PageTxt.Text = ((Convert.ToInt32(PageTxt.Text.ToString())) - 1).ToString(); } } }
private async void QueryButton_Click(object sender, RoutedEventArgs e) { MyProgressRing.IsActive = true; DataGrid.ItemsSource = null; AllRecords.Text = "0"; AllPageIndex.Text = "0"; PageTxt.Text = "0"; DateTime startDate = DateTime.Parse(StartDatePicker.Date.ToString()); string startDatestring = startDate.ToString("MM-dd-yyyy"); DateTime endDate = DateTime.Parse(EndDatePicker.Date.ToString()); string endDatestring = endDate.ToString("MM-dd-yyyy"); EscalationThreadList = await FTEEscalationThreadViewModel.QueryAllEscalationAndStatusThread(AllMyPlatform, EscalatonStatusList, startDatestring, endDatestring); ComboBoxItem curItem = (ComboBoxItem)PageComboBox.SelectedItem; pageSize = Convert.ToInt32(curItem.Content.ToString()); if (EscalationThreadList.Count == 0) { AllRecords.Text = "0"; AllPageIndex.Text = "0"; PageTxt.Text = "0"; DataGrid.ItemsSource = EscalationThreadList; MyScrollView.Height = 100; } else if (EscalationThreadList.Count < 10) { DataGrid.ItemsSource = EscalationThreadList; MyScrollView.Height = (EscalationThreadList.Count + 1) * 60; AllRecords.Text = FTEEscalationThreadViewModel.GetPageIndex(EscalationThreadList, pageSize).ToString();; AllPageIndex.Text = "1"; PageTxt.Text = "1"; } else { AllRecords.Text = EscalationThreadList.Count.ToString(); AllPageIndex.Text = FTEEscalationThreadViewModel.GetPageIndex(EscalationThreadList, pageSize).ToString(); int AllPagesIndex = FTEEscalationThreadViewModel.GetPageIndex(EscalationThreadList, pageSize); PageTxt.Text = "1"; if (EscalationThreadList.Count >= 10) { MyScrollView.Height = 650; } if (AllPagesIndex == 1) { DataGrid.ItemsSource = EscalationThreadList; } else { var EscalationThreadListPage = EscalationThreadList.Skip(0 * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage; } } await Task.Delay(new TimeSpan(3000)); MyProgressRing.IsActive = false; }
private void FirstImage_Tapped(object sender, TappedRoutedEventArgs e) { var EscalationThreadListPage1 = EscalationThreadList.Skip(0 * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage1; setScrollViewheight(EscalationThreadListPage1); PageTxt.Text = "1"; }
private void LastImage_Tapped(object sender, TappedRoutedEventArgs e) { int AllPageIndex = GetPageIndex(); PageTxt.Text = AllPageIndex.ToString(); var EscalationThreadListPage = EscalationThreadList.Skip((AllPageIndex - 1) * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage; setScrollViewheight(EscalationThreadListPage); PageTxt.Text = AllPageIndex.ToString(); }
private void FirstImage_Tapped(object sender, TappedRoutedEventArgs e) { if (EscalationThreadList.Count == 0) { this.PageTxt.Text = "0"; MyScrollView.Height = 100; DataGrid.ItemsSource = null; } else { var EscalationThreadListPage1 = EscalationThreadList.Skip(0 * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage1; setScrollViewheight(EscalationThreadListPage1); PageTxt.Text = "1"; } }
private async void QueryButton_Click(object sender, RoutedEventArgs e) { HttpClient HttpClient = new HttpClient(); Product MyProduct = new Product(); MyProduct = PlatformComboBox.SelectedItem as Product; string plaform = MyProduct.Platform; EscalationStatus MyEscalationStatus = new EscalationStatus(); MyEscalationStatus = StatusComboBox.SelectedItem as EscalationStatus; string status = MyEscalationStatus.Status; DateTime startDate = DateTime.Parse(StartDatePicker.Date.ToString()); string startDatestring = startDate.ToString("MM-dd-yyyy"); DateTime endDate = DateTime.Parse(EndDatePicker.Date.ToString()); string endDatestring = endDate.ToString("MM-dd-yyyy"); var HttpResponseMessage = await HttpClient.GetAsync(new Uri(string.Format("http://escalationmanagerwebapi.azurewebsites.net/api/ethreads?etime1={0}&etime2={1}&alias={2}&platform={3}&forum={4}&status={5}", startDatestring, endDatestring, "fapeng", plaform, "", status))); ObservableCollection <EscalationThread> AllMyEscalationThread = new ObservableCollection <EscalationThread>(); if (HttpResponseMessage.StatusCode == HttpStatusCode.Ok) { EscalationThreadList.Items.Clear(); var result = await HttpResponseMessage.Content.ReadAsStringAsync(); AllMyEscalationThread = JsonConvert.DeserializeObject <ObservableCollection <EscalationThread> >(result); foreach (var escalationthread in AllMyEscalationThread) { EscalationAndStatusThread EscalationAndStatusThread = new EscalationAndStatusThread(); EscalationAndStatusThread.EscalationThread = escalationthread; EscalationAndStatusThread.EscalationStatusList = EscalatonStatusList; EscalationThreadList.Items.Add(EscalationAndStatusThread); } } ComboBoxItem curItem = (ComboBoxItem)PageComboBox.SelectedItem; pageSize = Convert.ToInt32(curItem.Content.ToString()); if (EscalationThreadList.Count == 0) { AllRecords.Text = "0"; AllPageIndex.Text = "0"; PageTxt.Text = "0"; } else { AllRecords.Text = EscalationThreadList.Count.ToString(); AllPageIndex.Text = GetPageIndex().ToString(); int AllPagesIndex = GetPageIndex(); PageTxt.Text = "1"; if (EscalationThreadList.Count >= 10) { MyScrollView.Height = 650; } if (AllPagesIndex == 1) { DataGrid.ItemsSource = EscalationThreadList; } else { var EscalationThreadListPage = EscalationThreadList.Skip(0 * pageSize).Take(pageSize).ToList(); DataGrid.ItemsSource = EscalationThreadListPage; } } }