private void RefreshCourseList() { if (HttpCommunication.GetAllMyCourses(ProgramData.LoginId, out dynamic datas, out string msg)) { listView_Courses.Items.Clear(); if (datas != null) { foreach (var data in datas) { listView_Courses.Items.Add(new ListViewItem(new string[] { data.op_type, data.op_code, data.cname, data.teacher })); } } } statusLabel.Text = msg; btn_delSelection.Enabled = false; }
private void timer_keepConnectAlive_Elapsed(object sender, EventArgs e) { if (ProgramData.LoginSuccess) { // If action not finish yet, do not block network source. if (!(_timerLoopRegister.Enabled || _timerLoopSelect.Enabled)) { if (!HttpCommunication.GetAllMyCourses(ProgramData.LoginId, out _, out _)) { AddLog("已由伺服器端離線。"); LostConnect(); } else { Debug.Print(DateTime.Now.ToLongTimeString() + " - Keep connection alive."); } } } }