private void Button_Click_3(object sender, RoutedEventArgs e) { // P_list.Clear(); P_list = PublicationList.sort_P_list(Orgin_list, 1900, 2100, true); list2.ItemsSource = P_list; list2.Items.Refresh(); }
private void invert_Click(object sender, RoutedEventArgs e) { // list2.Items.Refresh(); if (list2.Items.Count > 0)//listbox is not empty { List <database.researcher> rlist = (ResearcherList.generate_R_list()); // PublicationList.additemt_p_listbox(list2, tmp_list); //P_list = tmp_list; //list2.ItemsSource = P_list; // invert_control = false; if (invert_control == true)//click once invert,click twice resume { //list2.Items.Clear(); //tmp_list = PublicationList.sort_P_list(P_list, Convert.ToInt32(cbo1.SelectedItem), Convert.ToInt32(cbo2.SelectedItem), true); // PublicationList.additemt_p_listbox(list2, tmp_list); P_list = PublicationList.sort_P_list(P_list, 1900, 2100, true); // tmp_list = P_list; list2.ItemsSource = P_list; list2.Items.Refresh(); // P_list = tmp_list; invert_control = false; } else { //list2.Items.Clear(); P_list = PublicationList.sort_P_list(P_list, 1900, 2100, false); // PublicationList.additemt_p_listbox(list2, tmp_list); // tmp_list = P_list; list2.ItemsSource = P_list; list2.Items.Refresh(); invert_control = true; } } else { MessageBox.Show("Publication list is empty "); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (list2.Items.Count != 0) { if (Convert.ToInt32(cbo2.SelectedItem) >= Convert.ToInt32(cbo1.SelectedItem)) { P_list = PublicationList.sort_P_list(Orgin_list, Convert.ToInt32(cbo1.SelectedItem), Convert.ToInt32(cbo2.SelectedItem), false); list2.ItemsSource = P_list; list2.Items.Refresh(); // list2.Items.Clear(); //PublicationList.additemt_p_listbox(list2, tmp_list); } else { MessageBox.Show("Year range error,later year mus larger than former year!"); } } else { MessageBox.Show("List is empty!"); } }