Ejemplo n.º 1
0
        private void ListBox_SelectedIndexChanged(object sender, RoutedEventArgs e)//event of researcher list
        {
            //disable 'showname'btn,'cumulative count'btn and datagrid before user select a record
            btn1.IsEnabled      = true;
            btn2.IsEnabled      = true;
            datagrid1.IsEnabled = true;

            list2.ItemsSource = P_list;
            //r_details.GotFocus = true;


            //filter function bug here
            if (list1.SelectedIndex != -1)         //if user selected a listitem and use filter function,application will be crushed
            {
                BitmapImage b = new BitmapImage(); //Generate avatar
                b.BeginInit();
                b.UriSource = new Uri(@rlist[list1.SelectedIndex].photo.ToString());
                b.EndInit();
                avatar.Source = b;
                //show details of specific researcher
                ContentControl1.Content = ResearcherDetail.showdetail(rlist[list1.SelectedIndex].id, rlist, position_list, researcher_publication_list, publication_list, btn1);
                datagrid1.ItemsSource   = null; //reset datagrid
                tbk_name.Text           = "";   //reset show name


                global_id = rlist[list1.SelectedIndex].id;//set grobal value for id

                P_list            = PublicationList.generate_P_list(rlist[list1.SelectedIndex].id, researcher_publication_list, publication_list);
                Orgin_list        = P_list;
                list2.ItemsSource = P_list;
                list2.Items.Refresh();

                tab_m.SelectedIndex = 1;//auto jump to tab 2
            }
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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 ");
            }
        }
Ejemplo n.º 4
0
        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!");
            }
        }