private void EventThreadFinished_LoadFile(object sender, CFileIO.ThreadFinishedEventArgs e) { this.UIThread(delegate { RICH_HISTORY_MSG.Clear(); List<string> dispTextIn = new List<string>(); for (int i = 0; i < e.list.Count; i++) { string strData = e.list.ElementAt(i); if (strData.Contains("@") == true) { dispTextIn.Add(strData); } else { RICH_HISTORY_MSG.AppendText(strData + System.Environment.NewLine); } } RICH_HISTORY_MSG.ScrollToCaret(); uc_view_history.SetDispTextObjects(dispTextIn); uc_view_history.Refresh(); }); }
private void LV_HISTORY_SelectedIndexChanged(object sender, EventArgs e) { if (LV_HISTORY.FocusedItem == null) return; LV_HISTORY.ItemSelectionChanged -= new ListViewItemSelectionChangedEventHandler(LV_HISTORY_SelectedIndexChanged); // Message Window Clear RICH_HISTORY_MSG.Clear(); // Get Selected Item int nIndex = LV_HISTORY.FocusedItem.Index; string strDate = LV_HISTORY.Items[nIndex].SubItems[1].Text; string strImageFile = LV_HISTORY.Items[nIndex].SubItems[2].Text; // Parsing string PATH_DATE = Path.Combine(m_fm.param_path.i07_PATH_HIST_MEASURE, strDate); string PATH_IMAGE = Path.Combine(m_fm.param_path.i07_PATH_HIST_MEASURE, strDate, strImageFile); string strTimeCode = strImageFile.Substring(0, 12); string strInspFile = strTimeCode + "_INSP.txt"; string PATH_INSP = Path.Combine(PATH_DATE, strInspFile); // Load Image uc_view_history.ThreadCall_LoadImage(PATH_IMAGE); System.Threading.Thread.Sleep(100); // Load Display Data and refresh if (File.Exists(PATH_INSP) == true) { uc_view_history.ThreadCall_LoadFile(fileIO, PATH_INSP); } uc_view_history.Refresh(); // Get Recp File Names String[] strArrAllFiles = System.IO.Directory.GetFiles(m_fm.param_path.i07_PATH_HIST_MEASURE, "*.*", System.IO.SearchOption.AllDirectories); string PATH_PREV_RECP = string.Empty; for (int i = 0; i < strArrAllFiles.Length; i++) { if (strArrAllFiles.ElementAt(i).Contains(strTimeCode) && strArrAllFiles.ElementAt(i).Contains(".xml")) { PATH_PREV_RECP = strArrAllFiles.ElementAt(i); } } // update set information TXT_HISTORY_PREV_IMAGE.Text = PATH_IMAGE; TXT_HISTORY_PREV_RECP.Text = PATH_PREV_RECP; LV_HISTORY.ItemSelectionChanged -= new ListViewItemSelectionChangedEventHandler(LV_HISTORY_SelectedIndexChanged); }
private void BTN_UPDATE_HISTORY_Click(object sender, EventArgs e) { LV_HISTORY.Items.Clear(); RICH_HISTORY_MSG.Clear(); TXT_HISTORY_PREV_RECP.Text = string.Empty; TXT_HISTORY_PREV_IMAGE.Text = string.Empty; string strPathHistory = m_fm.param_path.i07_PATH_HIST_MEASURE; String[] arrAllFiles = System.IO.Directory.GetFiles(strPathHistory, "*.*", System.IO.SearchOption.AllDirectories); LV_HISTORY.BeginUpdate(); Array.Reverse(arrAllFiles); for (int i = 0; i < arrAllFiles.Length; i++) { string single = arrAllFiles.ElementAt(i); string strFileName = Path.GetFileName(single); if (Path.GetExtension(strFileName).ToUpper() == ".XML") continue; if (Path.GetExtension(strFileName).ToUpper() == ".TXT") continue; string strDate = single.Replace(m_fm.param_path.i07_PATH_HIST_MEASURE + "\\", ""); /*****/strDate = strDate.Replace(strFileName, "").Replace("\\", ""); ListViewItem lvi = new ListViewItem(); int nCount = LV_HISTORY.Items.Count; lvi.Text = (nCount + 1).ToString(); lvi.SubItems.Add(strDate); lvi.SubItems.Add(strFileName); LV_HISTORY.Items.Add(lvi); } LV_HISTORY.EndUpdate(); }