private void timer_loopDelete_Elapsed(object sender, EventArgs e) { if (ProgramData.LoginSuccess) { if (checkBox_DelCourseFirst.Checked) { string opCode = ProgramData.ReadyToDeleteCoursesList[ProgramData.CurrentDeleteCourseIdx].ToString(); HttpCommunication.DeleteSelection(opCode, out string msg); if (ProgramData.CurrentDeleteCourseIdx + 1 == ProgramData.ReadyToDeleteCoursesList.Count) { _timerLoopDelete.Stop(); } else { ProgramData.CurrentDeleteCourseIdx += 1; } AddLog(msg); } } }
private void btn_delSelection_Click(object sender, EventArgs e) { string seletedItemString = listView_Courses.SelectedItems[0].SubItems[2].Text + "(" + listView_Courses.SelectedItems[0].SubItems[1].Text + ")"; string opcode = listView_Courses.SelectedItems[0].SubItems[1].Text; string msg = null; if (MessageBox.Show( "您確定要退選 [" + seletedItemString + "] 嗎", "確認退選", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (HttpCommunication.DeleteSelection(opcode, out msg)) { MessageBox.Show(msg, "退選成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(msg, "退選失敗", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } RefreshCourseList(); }