コード例 #1
0
 private void FmStudentMain_Load(object sender, EventArgs e)
 {
     //公告列表
     GetAllNewsListBusiness getAllNewsListBusiness = new GetAllNewsListBusiness();
     newsModelList = getAllNewsListBusiness.getAllNewsList();
     if (newsModelList == null)
     {
         MessageBox.Show("读取失败,请重试。");
     }
     else
     {
         int listLength = newsModelList.Length;
         for (int i = 0; i < listLength; i++)
         {
             this.listBox1.Items.Add(newsModelList[i].Title);
         }
     }
 }
コード例 #2
0
 //刷新公告列表
 private void button5_Click(object sender, EventArgs e)
 {
     this.checkedListBox1.Hide();
     this.label3.Show();
     this.label3.Text = "正在给力的拉取数据,请稍等...";
     this.label3.Refresh();
     GetAllNewsListBusiness getAllNewsListBusiness = new GetAllNewsListBusiness();
     newsModelList = getAllNewsListBusiness.getAllNewsList();
     if (newsModelList == null)
     {
         MessageBox.Show("读取失败,请重试。");
         this.label3.Text = "请点击右侧“刷新列表”读取公告列表";
         this.label3.Refresh();
     }
     else
     {
         this.label3.Hide();
         this.checkedListBox1.Show();
         this.checkedListBox1.Items.Clear();
         int listLength = newsModelList.Length;
         for (int i = 0; i < listLength; i++)
         {
             this.checkedListBox1.Items.Add(newsModelList[i].Title);
         }
         this.button3.Enabled = true;
     }
 }