private void btnDownload_btnPausing_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; // 先撈一次MeetingData MouseTool.ShowLoading(); //GetMeetingData.AsyncPOST(userMeeting.ID, UserID, UserPWD, (md) => { GetMeetingData_DoAction(md,(Image)sender); }); if (NetworkTool.CheckNetwork() > 0) { GetMeetingData.AsyncPOST(userMeeting.ID, UserID, UserPWD, (md) => { GetMeetingData_DoAction(md, (Image)sender); }); } else { //DB查詢登入 DataTable dt = MSCE.GetDataTable("select MeetingJson from MeetingData where MeetingID=@1 and UserID =@2" , userMeeting.ID , UserID); if (dt.Rows.Count > 0) { MeetingData md = JsonConvert.DeserializeObject <MeetingData>(dt.Rows[0]["MeetingJson"].ToString()); GetMeetingData_DoAction(md, (Image)sender); } else { AutoClosingMessageBox.Show("無法取得資料,請稍後再試"); MouseTool.ShowArrow(); } } }
private void btnDownload_btnPausing_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Action <MeetingData> action = null; _003C_003Ec__DisplayClass21 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass21(); _003C_003Ec__DisplayClass.sender = sender; _003C_003Ec__DisplayClass._003C_003E4__this = this; e.Handled = true; MouseTool.ShowLoading(); if (NetworkTool.CheckNetwork() > 0) { string iD = userMeeting.ID; string userID = UserID; string userPWD = UserPWD; if (action == null) { action = new Action <MeetingData>(_003C_003Ec__DisplayClass._003CbtnDownload_btnPausing_MouseLeftButtonDown_003Eb__1f); } GetMeetingData.AsyncPOST(iD, userID, userPWD, action); } else { DataTable dataTable = MSCE.GetDataTable("select MeetingJson from MeetingData where MeetingID=@1 and UserID =@2", userMeeting.ID, UserID); if (dataTable.Rows.Count > 0) { MeetingData md = JsonConvert.DeserializeObject <MeetingData>(dataTable.Rows[0]["MeetingJson"].ToString()); GetMeetingData_DoAction(md, (Image)_003C_003Ec__DisplayClass.sender); } else { AutoClosingMessageBox.Show("無法取得資料,請稍後再試"); MouseTool.ShowArrow(); } } }
//預載會議資料 private void PreLoadMeeting() { //小於0為沒有Cache //等於0為Cache不會過期 //大於0為多少分鐘後清掉Cache if (this.CacheMinuteTTL >= 0) { Task.Factory.StartNew(() => { GetMeetingData.AsyncPOST(userMeeting.ID, UserID, UserPWD, (md) => { try { PreLoadMeetingData = md; //[過時]因為CacheMinuteTTL是以分鐘為計算,如果是以秒鐘為計算的話 //[過時]最好放在上面的AsyncPOST裡面 //已改為放在AsyncPOST裡 if (this.CacheMinuteTTL > 0) { if (CacheThread != null) { CacheThread.Abort(); } CacheThread = new Thread(delegate() { Thread.Sleep(this.CacheMinuteTTL * 60 * 1000); PreLoadMeetingData = null; }); CacheThread.IsBackground = true; CacheThread.Start(); } } catch (Exception ex) { LogTool.Debug(ex); } }); }); } }
private void _003CPreLoadMeeting_003Eb__2() { GetMeetingData.AsyncPOST(userMeeting.ID, UserID, UserPWD, new Action <MeetingData>(_003CPreLoadMeeting_003Eb__3)); }